Improve Meson64 Support
BPI-CM4: In accordance with the BSP DTS, set LED gpio to GPIO_ACTIVE_LOW. Added default-on trigger to led-green Board now powers off, added reboot node 'meson64-reboot'. CONFIG_POWER_RESET_MESON64 Isolated RESET ODROID driver and renamed to MESON64 as it can be used in more than ODROIDS. MESON UART Series improves support for UART attached Bluetooth modules on Amlogic Meson G12A and newer SoCs. These SoCs also support the "divide XTAL by 2" bit which (greatly) reduces jitter when generating baud rates such as 1500000 (which is used by the Bluetooth part of the RTL8822CS SDIO WiFi and UART Bluetooth combo chip). Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
This commit is contained in:
parent
3c075bf1cc
commit
bb48f6080c
@ -4527,7 +4527,7 @@ CONFIG_POWER_RESET_BRCMSTB=y
|
||||
# CONFIG_POWER_RESET_GPIO_RESTART is not set
|
||||
# CONFIG_POWER_RESET_LTC2952 is not set
|
||||
# CONFIG_POWER_RESET_MT6323 is not set
|
||||
CONFIG_POWER_RESET_ODROID=y
|
||||
CONFIG_POWER_RESET_MESON64=y
|
||||
# CONFIG_POWER_RESET_REGULATOR is not set
|
||||
CONFIG_POWER_RESET_RESTART=y
|
||||
# CONFIG_POWER_RESET_TPS65086 is not set
|
||||
|
||||
@ -4550,7 +4550,7 @@ CONFIG_POWER_RESET_ATC260X=m
|
||||
CONFIG_POWER_RESET_BRCMSTB=y
|
||||
# CONFIG_POWER_RESET_GPIO is not set
|
||||
# CONFIG_POWER_RESET_GPIO_RESTART is not set
|
||||
CONFIG_POWER_RESET_ODROID=y
|
||||
CONFIG_POWER_RESET_MESON64=y
|
||||
# CONFIG_POWER_RESET_LTC2952 is not set
|
||||
# CONFIG_POWER_RESET_MT6323 is not set
|
||||
# CONFIG_POWER_RESET_REGULATOR is not set
|
||||
|
||||
@ -83,12 +83,9 @@ index 97b42e2100e0..d4b315a05ef9 100644
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gsking-x.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts
|
||||
new file mode 100644
|
||||
index 000000000000..1b0c3881c6a1
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts
|
||||
@@ -0,0 +1,165 @@
|
||||
--- /dev/null 2023-05-21 09:58:01.101444638 -0400
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts 2023-05-29 07:19:26.254573254 -0400
|
||||
@@ -0,0 +1,172 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2023 Neil Armstrong <neil.armstrong@linaro.org>
|
||||
@ -111,6 +108,12 @@ index 000000000000..1b0c3881c6a1
|
||||
+ i2c1 = &i2c3;
|
||||
+ };
|
||||
+
|
||||
+ reboot: meson64-reboot {
|
||||
+ compatible = "meson64,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+ };
|
||||
+
|
||||
+ adc-keys {
|
||||
+ compatible = "adc-keys";
|
||||
+ io-channels = <&saradc 2>;
|
||||
@ -141,14 +144,15 @@ index 000000000000..1b0c3881c6a1
|
||||
+ led-blue {
|
||||
+ color = <LED_COLOR_ID_BLUE>;
|
||||
+ function = LED_FUNCTION_STATUS;
|
||||
+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "heartbeat";
|
||||
+ };
|
||||
+
|
||||
+ led-green {
|
||||
+ color = <LED_COLOR_ID_GREEN>;
|
||||
+ function = LED_FUNCTION_STATUS;
|
||||
+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "default-on";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
|
||||
21
patch/kernel/archive/meson64-6.1/board-odroidc4-reset.patch
Normal file
21
patch/kernel/archive/meson64-6.1/board-odroidc4-reset.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
index 8c30ce636..ee8aa390e 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -11,6 +11,16 @@ / {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
|
||||
+ meson64-reboot {
|
||||
+ compatible = "meson64,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@ -1,24 +1,3 @@
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
index 8c30ce636..ee8aa390e 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -11,6 +11,16 @@ / {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
|
||||
+ odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index 4b563db3a..14396a3fc 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
@ -27,12 +6,12 @@ index 4b563db3a..14396a3fc 100644
|
||||
help
|
||||
This driver supports restart for Microsemi Ocelot SoC and similar.
|
||||
|
||||
+config POWER_RESET_ODROID
|
||||
+ bool "odroid reboot/power-off driver"
|
||||
+config POWER_RESET_MESON64
|
||||
+ bool "meson64 reboot/power-off driver"
|
||||
+ depends on ARCH_MESON
|
||||
+ help
|
||||
+ This driver supports restart / power off board for amlogic
|
||||
+ g12a/g12b/sm1 SoCs
|
||||
+ The driver supports restart / power off for amlogic
|
||||
+ g12a, g12b and sm1 SoCs
|
||||
+
|
||||
config POWER_RESET_OXNAS
|
||||
bool "OXNAS SoC restart driver"
|
||||
@ -45,19 +24,19 @@ index f606a2f60..ce0149984 100644
|
||||
obj-$(CONFIG_POWER_RESET_LINKSTATION) += linkstation-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o
|
||||
+obj-$(CONFIG_POWER_RESET_ODROID) += odroid-reboot.o
|
||||
+obj-$(CONFIG_POWER_RESET_MESON64) += meson64-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_OXNAS) += oxnas-restart.o
|
||||
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
|
||||
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
|
||||
diff --git a/drivers/power/reset/odroid-reboot.c b/drivers/power/reset/odroid-reboot.c
|
||||
diff --git a/drivers/power/reset/meson64-reboot.c b/drivers/power/reset/meson64-reboot.c
|
||||
new file mode 100644
|
||||
index 000000000..00fedd36b
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/odroid-reboot.c
|
||||
+++ b/drivers/power/reset/meson64-reboot.c
|
||||
@@ -0,0 +1,186 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0)
|
||||
+/*
|
||||
+ * drivers/power/reset/odroid-reboot.c
|
||||
+ * drivers/power/reset/meson64-reboot.c
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ * Copyright (C) 2023 Ash Hughes (sehguh.hsa@gmail.com)
|
||||
@ -119,7 +98,7 @@ index 000000000..00fedd36b
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+void odroid_card_reset(void)
|
||||
+void meson64_card_reset(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
@ -174,37 +153,37 @@ index 000000000..00fedd36b
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int do_odroid_restart(struct notifier_block *this, unsigned long mode, void *cmd)
|
||||
+static int do_meson64_restart(struct notifier_block *this, unsigned long mode, void *cmd)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+ meson64_card_reset();
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block odroid_restart_handler = {
|
||||
+ .notifier_call = do_odroid_restart,
|
||||
+static struct notifier_block meson64_restart_handler = {
|
||||
+ .notifier_call = do_meson64_restart,
|
||||
+ .priority = 130,
|
||||
+};
|
||||
+
|
||||
+static void do_odroid_poweroff(void)
|
||||
+static void do_meson64_poweroff(void)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+ meson64_card_reset();
|
||||
+
|
||||
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static int odroid_restart_probe(struct platform_device *pdev)
|
||||
+static int meson64_restart_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *of_node;
|
||||
+ u32 id;
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_reset", &id)) {
|
||||
+ psci_function_id_restart = id;
|
||||
+ register_restart_handler(&odroid_restart_handler);
|
||||
+ register_restart_handler(&meson64_restart_handler);
|
||||
+ }
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
|
||||
+ psci_function_id_poweroff = id;
|
||||
+ pm_power_off = do_odroid_poweroff;
|
||||
+ pm_power_off = do_meson64_poweroff;
|
||||
+ }
|
||||
+
|
||||
+ of_node = pdev->dev.of_node;
|
||||
@ -221,23 +200,23 @@ index 000000000..00fedd36b
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id of_odroid_restart_match[] = {
|
||||
+ { .compatible = "odroid,reboot", },
|
||||
+static const struct of_device_id of_meson64_restart_match[] = {
|
||||
+ { .compatible = "meson64,reboot", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, of_odroid_restart_match);
|
||||
+MODULE_DEVICE_TABLE(of, of_meson64_restart_match);
|
||||
+
|
||||
+static struct platform_driver odroid_restart_driver = {
|
||||
+ .probe = odroid_restart_probe,
|
||||
+static struct platform_driver meson64_restart_driver = {
|
||||
+ .probe = meson64_restart_probe,
|
||||
+ .driver = {
|
||||
+ .name = "odroid-restart",
|
||||
+ .of_match_table = of_match_ptr(of_odroid_restart_match),
|
||||
+ .name = "meson64-restart",
|
||||
+ .of_match_table = of_match_ptr(of_meson64_restart_match),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init odroid_restart_init(void)
|
||||
+static int __init meson64_restart_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&odroid_restart_driver);
|
||||
+ return platform_driver_register(&meson64_restart_driver);
|
||||
+}
|
||||
+device_initcall(odroid_restart_init);
|
||||
+device_initcall(meson64_restart_init);
|
||||
+
|
||||
@ -0,0 +1,115 @@
|
||||
diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
|
||||
index 3cbdde85ed71..22656efe8ddc 100644
|
||||
--- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
|
||||
+++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
|
||||
@@ -34,6 +34,11 @@ properties:
|
||||
- amlogic,meson-gx-uart
|
||||
- amlogic,meson-s4-uart
|
||||
- const: amlogic,meson-ao-uart
|
||||
+ - description: Always-on power domain UART controller on G12A SoCs
|
||||
+ items:
|
||||
+ - const: amlogic,meson-g12a-uart
|
||||
+ - const: amlogic,meson-gx-uart
|
||||
+ - const: amlogic,meson-ao-uart
|
||||
- description: Everything-Else power domain UART controller
|
||||
enum:
|
||||
- amlogic,meson6-uart
|
||||
@@ -41,6 +46,10 @@ properties:
|
||||
- amlogic,meson8b-uart
|
||||
- amlogic,meson-gx-uart
|
||||
- amlogic,meson-s4-uart
|
||||
+ - description: Everything-Else power domain UART controller on G12A SoCs
|
||||
+ items:
|
||||
+ - const: amlogic,meson-g12a-uart
|
||||
+ - const: amlogic,meson-gx-uart
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
--
|
||||
2.39.2
|
||||
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
|
||||
index 74110017988a..2501db5a7aaf 100644
|
||||
--- a/drivers/tty/serial/meson_uart.c
|
||||
+++ b/drivers/tty/serial/meson_uart.c
|
||||
@@ -779,7 +779,7 @@ static int meson_uart_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static struct meson_uart_data s4_uart_data = {
|
||||
+static struct meson_uart_data meson_g12a_uart_data = {
|
||||
.has_xtal_div2 = true,
|
||||
};
|
||||
|
||||
@@ -788,9 +788,13 @@ static const struct of_device_id meson_uart_dt_match[] = {
|
||||
{ .compatible = "amlogic,meson8-uart" },
|
||||
{ .compatible = "amlogic,meson8b-uart" },
|
||||
{ .compatible = "amlogic,meson-gx-uart" },
|
||||
+ {
|
||||
+ .compatible = "amlogic,meson-g12a-uart",
|
||||
+ .data = (void *)&meson_g12a_uart_data,
|
||||
+ },
|
||||
{
|
||||
.compatible = "amlogic,meson-s4-uart",
|
||||
- .data = (void *)&s4_uart_data,
|
||||
+ .data = (void *)&meson_g12a_uart_data,
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
--
|
||||
2.39.2
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 123a56f7f818..904bcd4d2acf 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -2046,7 +2046,8 @@ pwm_AO_cd: pwm@2000 {
|
||||
};
|
||||
|
||||
uart_AO: serial@3000 {
|
||||
- compatible = "amlogic,meson-gx-uart",
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart",
|
||||
"amlogic,meson-ao-uart";
|
||||
reg = <0x0 0x3000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>;
|
||||
@@ -2056,7 +2057,8 @@ uart_AO: serial@3000 {
|
||||
};
|
||||
|
||||
uart_AO_B: serial@4000 {
|
||||
- compatible = "amlogic,meson-gx-uart",
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart",
|
||||
"amlogic,meson-ao-uart";
|
||||
reg = <0x0 0x4000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 197 IRQ_TYPE_EDGE_RISING>;
|
||||
@@ -2293,7 +2295,8 @@ clk_msr: clock-measure@18000 {
|
||||
};
|
||||
|
||||
uart_C: serial@22000 {
|
||||
- compatible = "amlogic,meson-gx-uart";
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x22000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>;
|
||||
@@ -2302,7 +2305,8 @@ uart_C: serial@22000 {
|
||||
};
|
||||
|
||||
uart_B: serial@23000 {
|
||||
- compatible = "amlogic,meson-gx-uart";
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x23000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>;
|
||||
@@ -2311,7 +2315,8 @@ uart_B: serial@23000 {
|
||||
};
|
||||
|
||||
uart_A: serial@24000 {
|
||||
- compatible = "amlogic,meson-gx-uart";
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x24000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
|
||||
--
|
||||
2.39.2
|
||||
@ -83,12 +83,9 @@ index 97b42e2100e0..d4b315a05ef9 100644
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gsking-x.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking.dtb
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts
|
||||
new file mode 100644
|
||||
index 000000000000..1b0c3881c6a1
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts
|
||||
@@ -0,0 +1,165 @@
|
||||
--- /dev/null 2023-05-21 09:58:01.101444638 -0400
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi-cm4-cm4io.dts 2023-05-29 07:19:26.254573254 -0400
|
||||
@@ -0,0 +1,172 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * Copyright (c) 2023 Neil Armstrong <neil.armstrong@linaro.org>
|
||||
@ -111,6 +108,12 @@ index 000000000000..1b0c3881c6a1
|
||||
+ i2c1 = &i2c3;
|
||||
+ };
|
||||
+
|
||||
+ reboot: meson64-reboot {
|
||||
+ compatible = "meson64,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+ };
|
||||
+
|
||||
+ adc-keys {
|
||||
+ compatible = "adc-keys";
|
||||
+ io-channels = <&saradc 2>;
|
||||
@ -141,14 +144,15 @@ index 000000000000..1b0c3881c6a1
|
||||
+ led-blue {
|
||||
+ color = <LED_COLOR_ID_BLUE>;
|
||||
+ function = LED_FUNCTION_STATUS;
|
||||
+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "heartbeat";
|
||||
+ };
|
||||
+
|
||||
+ led-green {
|
||||
+ color = <LED_COLOR_ID_GREEN>;
|
||||
+ function = LED_FUNCTION_STATUS;
|
||||
+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "default-on";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
|
||||
35
patch/kernel/archive/meson64-6.2/board-odroidc4-reset.patch
Normal file
35
patch/kernel/archive/meson64-6.2/board-odroidc4-reset.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ash Hughes <spirit.returned@gmail.com>
|
||||
Date: Sat, 18 Feb 2023 07:46:38 -0300
|
||||
Subject: adapted meson64-reboot driver, fix reboot on odroid C4 when using
|
||||
UHS-II SD cards
|
||||
|
||||
bring back fixed version of `odroid-reboot` driver (Fix reboot on odroid C4 when using UHS-II SD cards)
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 10 +
|
||||
drivers/power/reset/Kconfig | 7 +
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/odroid-reboot.c | 186 ++++++++++
|
||||
4 files changed, 204 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
index 8c30ce63686e..ee8aa390ea56 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -11,6 +11,16 @@ / {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
|
||||
+ odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@ -1,77 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ash Hughes <spirit.returned@gmail.com>
|
||||
Date: Sat, 18 Feb 2023 07:46:38 -0300
|
||||
Subject: adapted odroid-reboot driver, fix reboot on odroid C4 when using
|
||||
UHS-II SD cards
|
||||
|
||||
bring back fixed version of `odroid-reboot` driver (Fix reboot on odroid C4 when using UHS-II SD cards)
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts | 10 +
|
||||
drivers/power/reset/Kconfig | 7 +
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/odroid-reboot.c | 186 ++++++++++
|
||||
4 files changed, 204 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
index 8c30ce63686e..ee8aa390ea56 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-c4.dts
|
||||
@@ -11,6 +11,16 @@ / {
|
||||
compatible = "hardkernel,odroid-c4", "amlogic,sm1";
|
||||
model = "Hardkernel ODROID-C4";
|
||||
|
||||
+ odroid-reboot {
|
||||
+ compatible = "odroid,reboot";
|
||||
+ sys_reset = <0x84000009>;
|
||||
+ sys_poweroff = <0x84000008>;
|
||||
+
|
||||
+ sd-vqen = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vqsw = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
|
||||
+ sd-vmmc = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index a8c46ba5878f..f685772c8213 100644
|
||||
index 4b563db3a..14396a3fc 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
+++ b/drivers/power/reset/Kconfig
|
||||
@@ -141,6 +141,13 @@ config POWER_RESET_OCELOT_RESET
|
||||
help
|
||||
This driver supports restart for Microsemi Ocelot SoC and similar.
|
||||
|
||||
+config POWER_RESET_ODROID
|
||||
+ bool "odroid reboot/power-off driver"
|
||||
+config POWER_RESET_MESON64
|
||||
+ bool "Meson64 reboot/power-off driver"
|
||||
+ depends on ARCH_MESON
|
||||
+ help
|
||||
+ This driver supports restart / power off board for amlogic
|
||||
+ g12a/g12b/sm1 SoCs
|
||||
+ The driver supports restart / power off for amlogic
|
||||
+ g12a, g12b and sm1 SoCs
|
||||
+
|
||||
config POWER_RESET_OXNAS
|
||||
bool "OXNAS SoC restart driver"
|
||||
depends on ARCH_OXNAS
|
||||
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
|
||||
index 0a39424fc558..b58a4f2891db 100644
|
||||
index f606a2f60..ce0149984 100644
|
||||
--- a/drivers/power/reset/Makefile
|
||||
+++ b/drivers/power/reset/Makefile
|
||||
@@ -14,6 +14,7 @@ obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_LINKSTATION) += linkstation-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o
|
||||
+obj-$(CONFIG_POWER_RESET_ODROID) += odroid-reboot.o
|
||||
+obj-$(CONFIG_POWER_RESET_MESON64) += meson64-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_OXNAS) += oxnas-restart.o
|
||||
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
|
||||
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
|
||||
diff --git a/drivers/power/reset/odroid-reboot.c b/drivers/power/reset/odroid-reboot.c
|
||||
diff --git a/drivers/power/reset/meson64-reboot.c b/drivers/power/reset/meson64-reboot.c
|
||||
new file mode 100644
|
||||
index 000000000000..0339718b4a80
|
||||
index 000000000..00fedd36b
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/odroid-reboot.c
|
||||
+++ b/drivers/power/reset/meson64-reboot.c
|
||||
@@ -0,0 +1,186 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0)
|
||||
+/*
|
||||
+ * drivers/power/reset/odroid-reboot.c
|
||||
+ * drivers/power/reset/meson64-reboot.c
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
+ * Copyright (C) 2023 Ash Hughes (sehguh.hsa@gmail.com)
|
||||
@ -133,7 +98,7 @@ index 000000000000..0339718b4a80
|
||||
+ return res.a0;
|
||||
+}
|
||||
+
|
||||
+void odroid_card_reset(void)
|
||||
+void meson64_card_reset(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
@ -188,37 +153,37 @@ index 000000000000..0339718b4a80
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int do_odroid_restart(struct notifier_block *this, unsigned long mode, void *cmd)
|
||||
+static int do_meson64_restart(struct notifier_block *this, unsigned long mode, void *cmd)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+ meson64_card_reset();
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block odroid_restart_handler = {
|
||||
+ .notifier_call = do_odroid_restart,
|
||||
+static struct notifier_block meson64_restart_handler = {
|
||||
+ .notifier_call = do_meson64_restart,
|
||||
+ .priority = 130,
|
||||
+};
|
||||
+
|
||||
+static void do_odroid_poweroff(void)
|
||||
+static void do_meson64_poweroff(void)
|
||||
+{
|
||||
+ odroid_card_reset();
|
||||
+ meson64_card_reset();
|
||||
+
|
||||
+ __invoke_psci_fn_smc(0x82000042, 1, 0, 0);
|
||||
+}
|
||||
+
|
||||
+static int odroid_restart_probe(struct platform_device *pdev)
|
||||
+static int meson64_restart_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *of_node;
|
||||
+ u32 id;
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_reset", &id)) {
|
||||
+ psci_function_id_restart = id;
|
||||
+ register_restart_handler(&odroid_restart_handler);
|
||||
+ register_restart_handler(&meson64_restart_handler);
|
||||
+ }
|
||||
+
|
||||
+ if (!of_property_read_u32(pdev->dev.of_node, "sys_poweroff", &id)) {
|
||||
+ psci_function_id_poweroff = id;
|
||||
+ pm_power_off = do_odroid_poweroff;
|
||||
+ pm_power_off = do_meson64_poweroff;
|
||||
+ }
|
||||
+
|
||||
+ of_node = pdev->dev.of_node;
|
||||
@ -235,26 +200,23 @@ index 000000000000..0339718b4a80
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id of_odroid_restart_match[] = {
|
||||
+ { .compatible = "odroid,reboot", },
|
||||
+static const struct of_device_id of_meson64_restart_match[] = {
|
||||
+ { .compatible = "meson64,reboot", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, of_odroid_restart_match);
|
||||
+MODULE_DEVICE_TABLE(of, of_meson64_restart_match);
|
||||
+
|
||||
+static struct platform_driver odroid_restart_driver = {
|
||||
+ .probe = odroid_restart_probe,
|
||||
+static struct platform_driver meson64_restart_driver = {
|
||||
+ .probe = meson64_restart_probe,
|
||||
+ .driver = {
|
||||
+ .name = "odroid-restart",
|
||||
+ .of_match_table = of_match_ptr(of_odroid_restart_match),
|
||||
+ .name = "meson64-restart",
|
||||
+ .of_match_table = of_match_ptr(of_meson64_restart_match),
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init odroid_restart_init(void)
|
||||
+static int __init meson64_restart_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&odroid_restart_driver);
|
||||
+ return platform_driver_register(&meson64_restart_driver);
|
||||
+}
|
||||
+device_initcall(odroid_restart_init);
|
||||
+device_initcall(meson64_restart_init);
|
||||
+
|
||||
--
|
||||
Armbian
|
||||
|
||||
@ -0,0 +1,115 @@
|
||||
diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
|
||||
index 3cbdde85ed71..22656efe8ddc 100644
|
||||
--- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
|
||||
+++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
|
||||
@@ -34,6 +34,11 @@ properties:
|
||||
- amlogic,meson-gx-uart
|
||||
- amlogic,meson-s4-uart
|
||||
- const: amlogic,meson-ao-uart
|
||||
+ - description: Always-on power domain UART controller on G12A SoCs
|
||||
+ items:
|
||||
+ - const: amlogic,meson-g12a-uart
|
||||
+ - const: amlogic,meson-gx-uart
|
||||
+ - const: amlogic,meson-ao-uart
|
||||
- description: Everything-Else power domain UART controller
|
||||
enum:
|
||||
- amlogic,meson6-uart
|
||||
@@ -41,6 +46,10 @@ properties:
|
||||
- amlogic,meson8b-uart
|
||||
- amlogic,meson-gx-uart
|
||||
- amlogic,meson-s4-uart
|
||||
+ - description: Everything-Else power domain UART controller on G12A SoCs
|
||||
+ items:
|
||||
+ - const: amlogic,meson-g12a-uart
|
||||
+ - const: amlogic,meson-gx-uart
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
--
|
||||
2.39.2
|
||||
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
|
||||
index 74110017988a..2501db5a7aaf 100644
|
||||
--- a/drivers/tty/serial/meson_uart.c
|
||||
+++ b/drivers/tty/serial/meson_uart.c
|
||||
@@ -779,7 +779,7 @@ static int meson_uart_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static struct meson_uart_data s4_uart_data = {
|
||||
+static struct meson_uart_data meson_g12a_uart_data = {
|
||||
.has_xtal_div2 = true,
|
||||
};
|
||||
|
||||
@@ -788,9 +788,13 @@ static const struct of_device_id meson_uart_dt_match[] = {
|
||||
{ .compatible = "amlogic,meson8-uart" },
|
||||
{ .compatible = "amlogic,meson8b-uart" },
|
||||
{ .compatible = "amlogic,meson-gx-uart" },
|
||||
+ {
|
||||
+ .compatible = "amlogic,meson-g12a-uart",
|
||||
+ .data = (void *)&meson_g12a_uart_data,
|
||||
+ },
|
||||
{
|
||||
.compatible = "amlogic,meson-s4-uart",
|
||||
- .data = (void *)&s4_uart_data,
|
||||
+ .data = (void *)&meson_g12a_uart_data,
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
--
|
||||
2.39.2
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index 123a56f7f818..904bcd4d2acf 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -2046,7 +2046,8 @@ pwm_AO_cd: pwm@2000 {
|
||||
};
|
||||
|
||||
uart_AO: serial@3000 {
|
||||
- compatible = "amlogic,meson-gx-uart",
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart",
|
||||
"amlogic,meson-ao-uart";
|
||||
reg = <0x0 0x3000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 193 IRQ_TYPE_EDGE_RISING>;
|
||||
@@ -2056,7 +2057,8 @@ uart_AO: serial@3000 {
|
||||
};
|
||||
|
||||
uart_AO_B: serial@4000 {
|
||||
- compatible = "amlogic,meson-gx-uart",
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart",
|
||||
"amlogic,meson-ao-uart";
|
||||
reg = <0x0 0x4000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 197 IRQ_TYPE_EDGE_RISING>;
|
||||
@@ -2293,7 +2295,8 @@ clk_msr: clock-measure@18000 {
|
||||
};
|
||||
|
||||
uart_C: serial@22000 {
|
||||
- compatible = "amlogic,meson-gx-uart";
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x22000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>;
|
||||
@@ -2302,7 +2305,8 @@ uart_C: serial@22000 {
|
||||
};
|
||||
|
||||
uart_B: serial@23000 {
|
||||
- compatible = "amlogic,meson-gx-uart";
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x23000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 75 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>;
|
||||
@@ -2311,7 +2315,8 @@ uart_B: serial@23000 {
|
||||
};
|
||||
|
||||
uart_A: serial@24000 {
|
||||
- compatible = "amlogic,meson-gx-uart";
|
||||
+ compatible = "amlogic,meson-g12a-uart",
|
||||
+ "amlogic,meson-gx-uart";
|
||||
reg = <0x0 0x24000 0x0 0x18>;
|
||||
interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
|
||||
clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
|
||||
--
|
||||
2.39.2
|
||||
Loading…
Reference in New Issue
Block a user