ipq807x: backport pstore support

v4.4 was missing OF support for this feature.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-09-16 15:27:20 +02:00
parent 2c3becff4b
commit 14d3c44184

View File

@@ -1,4 +1,4 @@
From 969714cb5e188d3d7a4391425c2a55354da13855 Mon Sep 17 00:00:00 2001
From ed0c6c49e0033c30207b1e4c925f19d67d087cfe Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 18 Jul 2020 08:53:44 +0200
Subject: [PATCH 01/30] ipq807x: add the Qualcomm AX target support
@@ -20,7 +20,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../linux/ipq807x/base-files/etc/init.d/wdt | 14 +
...G4_v5.4.B-AQR_CIG_WIFI_ID44715_VER1673.cld | Bin 0 -> 391170 bytes
.../base-files/lib/upgrade/platform.sh | 66 +
target/linux/ipq807x/config-4.4 | 824 +++++++++
target/linux/ipq807x/config-4.4 | 828 +++++++++
.../arm/boot/dts/qcom-ipq6018-cig-wf188.dts | 18 +
.../arm/boot/dts/qcom-ipq6018-cig-wf188n.dts | 18 +
.../boot/dts/qcom-ipq6018-edgecore-eap101.dts | 18 +
@@ -54,7 +54,8 @@ Signed-off-by: John Crispin <john@phrozen.org>
target/linux/ipq807x/patches/109-tplink.patch | 1518 +++++++++++++++++
.../ipq807x/patches/110-add-esmt-nand.patch | 37 +
target/linux/ipq807x/patches/111-eap106.patch | 765 +++++++++
49 files changed, 10107 insertions(+), 2 deletions(-)
target/linux/ipq807x/patches/112-pstore.patch | 190 +++
50 files changed, 10301 insertions(+), 2 deletions(-)
create mode 100644 package/boot/uboot-envtools/files/ipq807x
create mode 100644 target/linux/ipq807x/109-logspam.patch
create mode 100644 target/linux/ipq807x/Makefile
@@ -100,6 +101,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
create mode 100644 target/linux/ipq807x/patches/109-tplink.patch
create mode 100644 target/linux/ipq807x/patches/110-add-esmt-nand.patch
create mode 100644 target/linux/ipq807x/patches/111-eap106.patch
create mode 100644 target/linux/ipq807x/patches/112-pstore.patch
diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index f71114b5da..4a85d83118 100644
@@ -4811,10 +4813,10 @@ index 0000000000..4943b6c406
+}
diff --git a/target/linux/ipq807x/config-4.4 b/target/linux/ipq807x/config-4.4
new file mode 100644
index 0000000000..eeb1fec76c
index 0000000000..1b4b95b968
--- /dev/null
+++ b/target/linux/ipq807x/config-4.4
@@ -0,0 +1,824 @@
@@ -0,0 +1,828 @@
+# CONFIG_AHCI_IPQ is not set
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_ALLOW_DEV_COREDUMP is not set
@@ -5361,6 +5363,10 @@ index 0000000000..eeb1fec76c
+CONFIG_PRINTK_TIME=y
+CONFIG_PROC_PAGE_MONITOR=y
+# CONFIG_PROC_STRIPPED is not set
+CONFIG_PSTORE=y
+CONFIG_PSTORE_RAM=y
+# CONFIG_PSTORE_CONSOLE is not set
+# CONFIG_PSTORE_PMSG is not set
+CONFIG_PWM=y
+# CONFIG_PWM_IPQ4019 is not set
+# CONFIG_PWM_PCA9685 is not set
@@ -14704,6 +14710,202 @@ index 0000000000..497742193e
+ { PHY_ID_AQR112, 0xfffffff0 },
+ { PHY_ID_AQR113C, 0xfffffff0 },
+ { PHY_ID_AQR112C, 0xfffffff0 },
diff --git a/target/linux/ipq807x/patches/112-pstore.patch b/target/linux/ipq807x/patches/112-pstore.patch
new file mode 100644
index 0000000000..ed97c34241
--- /dev/null
+++ b/target/linux/ipq807x/patches/112-pstore.patch
@@ -0,0 +1,190 @@
+Index: linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
+===================================================================
+--- linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016.orig/arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
++++ linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
+@@ -92,6 +92,12 @@
+ reg = <0x0 0x40000000 0x0 0x00800000>;
+ };
+
++ ramoops@4A0f0000 {
++ compatible = "ramoops";
++ reg = <0 0x4A0f0000 0 0x10000>;
++ record-size = <0x1000>;
++ };
++
+ uboot@4A100000 {
+ no-map;
+ reg = <0x0 0x4A100000 0x0 0x00400000>;
+@@ -211,6 +217,12 @@
+ reg = <0x0 0x40000000 0x0 0x01000000>;
+ };
+
++ ramoops@4A0f0000 {
++ compatible = "ramoops";
++ reg = <0 0x4A0f0000 0 0x10000>;
++ record-size = <0x1000>;
++ };
++
+ uboot@4A100000 {
+ no-map;
+ reg = <0x0 0x4A100000 0x0 0x00400000>;
+@@ -330,6 +342,12 @@
+ reg = <0x0 0x40000000 0x0 0x01000000>;
+ };
+
++ ramoops@4A0f0000 {
++ compatible = "ramoops";
++ reg = <0 0x4A0f0000 0 0x10000>;
++ record-size = <0x1000>;
++ };
++
+ uboot@4A100000 {
+ no-map;
+ reg = <0x0 0x4A100000 0x0 0x00400000>;
+Index: linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/arch/arm64/boot/dts/qcom/qcom-ipq807x-memory.dtsi
+===================================================================
+--- linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016.orig/arch/arm64/boot/dts/qcom/qcom-ipq807x-memory.dtsi
++++ linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/arch/arm64/boot/dts/qcom/qcom-ipq807x-memory.dtsi
+@@ -94,6 +94,12 @@
+ no-map;
+ reg = <0x0 0x4a600000 0x0 0x00400000>;
+ };
++ ramoops@4a3f0000 {
++ compatible = "ramoops";
++ reg = <0 0x4a3f0000 0 0x10000>;
++ record-size = <0x1000>;
++ };
++
+ tzapp:tzapp@4a400000 { /* TZAPPS */
+ no-map;
+ reg = <0x0 0x4a400000 0x0 0x00100000>;
+@@ -214,6 +220,12 @@
+ no-map;
+ reg = <0x0 0x4a600000 0x0 0x00400000>;
+ };
++ ramoops@4a3f0000 {
++ compatible = "ramoops";
++ reg = <0 0x4a3f0000 0 0x10000>;
++ record-size = <0x1000>;
++ };
++
+ tzapp:tzapp@4a400000 { /* TZAPPS */
+ no-map;
+ reg = <0x0 0x4a400000 0x0 0x00100000>;
+@@ -334,6 +346,12 @@
+ reg = <0x0 0x40000000 0x0 0x01000000>;
+ };
+
++ ramoops@4a3f0000 {
++ compatible = "ramoops";
++ reg = <0 0x4a3f0000 0 0x10000>;
++ record-size = <0x1000>;
++ };
++
+ tzapp:tzapp@4a400000 { /* TZAPPS */
+ no-map;
+ reg = <0x0 0x4a400000 0x0 0x00200000>;
+Index: linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/fs/pstore/ram.c
+===================================================================
+--- linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016.orig/fs/pstore/ram.c
++++ linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/fs/pstore/ram.c
+@@ -466,15 +466,46 @@ static int ramoops_init_prz(struct devic
+ return 0;
+ }
+
++static int ramoops_parse_dt(struct platform_device *pdev,
++ struct ramoops_platform_data *pdata)
++{
++ struct resource *res;
++
++ dev_dbg(&pdev->dev, "using Device Tree\n");
++
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ if (!res) {
++ dev_err(&pdev->dev,
++ "failed to locate DT /reserved-memory resource\n");
++ return -EINVAL;
++ }
++
++ pdata->mem_size = resource_size(res);
++ pdata->mem_address = res->start;
++ pdata->dump_oops = true;
++ pdata->record_size = 0x1000;
++ return 0;
++}
++
+ static int ramoops_probe(struct platform_device *pdev)
+ {
+ struct device *dev = &pdev->dev;
+ struct ramoops_platform_data *pdata = pdev->dev.platform_data;
++ struct ramoops_platform_data pdata_local;
+ struct ramoops_context *cxt = &oops_cxt;
+ size_t dump_mem_sz;
+ phys_addr_t paddr;
+ int err = -EINVAL;
+
++ if (dev_of_node(dev) && !pdata) {
++ pdata = &pdata_local;
++ memset(pdata, 0, sizeof(*pdata));
++
++ err = ramoops_parse_dt(pdev, pdata);
++ if (err < 0)
++ goto fail_out;
++ }
++
+ /* Only a single ramoops area allowed at a time, so fail extra
+ * probes.
+ */
+@@ -603,11 +634,17 @@ static int ramoops_remove(struct platfor
+ return 0;
+ }
+
++static const struct of_device_id dt_match[] = {
++ { .compatible = "ramoops" },
++ {}
++};
++
+ static struct platform_driver ramoops_driver = {
+ .probe = ramoops_probe,
+ .remove = ramoops_remove,
+ .driver = {
+ .name = "ramoops",
++ .of_match_table = dt_match,
+ },
+ };
+
+Index: linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/drivers/of/platform.c
+===================================================================
+--- linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016.orig/drivers/of/platform.c
++++ linux-4.4.60-qsdk-11f09717303ecd83c3a64e9efe23f25921dc1016/drivers/of/platform.c
+@@ -53,6 +53,30 @@ struct platform_device *of_find_device_b
+ }
+ EXPORT_SYMBOL(of_find_device_by_node);
+
++static const struct of_device_id reserved_mem_matches[] = {
++ { .compatible = "ramoops" },
++ {}
++};
++
++static int __init of_platform_default_populate_init(void)
++{
++ struct device_node *node;
++
++ if (!of_have_populated_dt())
++ return -ENODEV;
++
++ /*
++ * Handle certain compatibles explicitly, since we don't want to create
++ * platform_devices for every node in /reserved-memory with a
++ * "compatible",
++ */
++ for_each_matching_node(node, reserved_mem_matches)
++ of_platform_device_create(node, NULL, NULL);
++
++ return 0;
++}
++arch_initcall_sync(of_platform_default_populate_init);
++
+ #ifdef CONFIG_OF_ADDRESS
+ /*
+ * The following routines scan a subtree and registers a device for
--
2.25.1