rockchip64/edge 6.6.y: update overlay configfs patch from rpi
- from b128f09592.patch
- found via https://github.com/raspberrypi/linux/commits/rpi-6.6.y/drivers/of/configfs.c
This commit is contained in:
parent
850a6c0da5
commit
80a0bf14fa
@ -1,39 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: schwar3kat <61094841+schwar3kat@users.noreply.github.com>
|
||||
Date: Mon, 16 Jan 2023 22:57:26 +1300
|
||||
From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
|
||||
Date: Wed, 3 Dec 2014 13:23:28 +0200
|
||||
Subject: OF: DT-Overlay configfs interface
|
||||
|
||||
Commit message: Clean up mbox format in general-add-overlay-configfs.patch. No diff changes.
|
||||
|
||||
Below patch is a squash of 4 commits borrowed from ayufan's
|
||||
https://github.com/ayufan-rock64/linux-mainline-kernel repo:
|
||||
|
||||
This is a port of Pantelis Antoniou's v3 port that makes use of the
|
||||
upstreamed configfs support for binary attributes.
|
||||
new upstreamed configfs support for binary attributes.
|
||||
|
||||
Original commit message:
|
||||
|
||||
Add a runtime interface to using configfs for generic device tree overlay
|
||||
usage. With it its possible to use device tree overlays without having
|
||||
to use a per-platform overlay manager.
|
||||
|
||||
Please see Documentation/devicetree/configfs-overlays.txt for more info.
|
||||
|
||||
Changes since v2:
|
||||
- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required)
|
||||
- Created a documentation entry
|
||||
- Slight rewording in Kconfig
|
||||
- Fix build errors
|
||||
|
||||
Changes since v1:
|
||||
- of_resolve() -> of_resolve_phandles().
|
||||
|
||||
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
|
||||
Originally-signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
|
||||
DT configfs: Fix build errors on other platforms
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
|
||||
DT configfs: fix build error
|
||||
|
||||
There is an error when compiling rpi-4.6.y branch:
|
||||
CC drivers/of/configfs.o
|
||||
drivers/of/configfs.c:291:21: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
|
||||
.default_groups = of_cfs_def_groups,
|
||||
^
|
||||
drivers/of/configfs.c:291:21: note: (near initialization for 'of_cfs_subsys.su_group.default_groups.next')
|
||||
|
||||
The .default_groups is linked list since commit
|
||||
1ae1602de028acaa42a0f6ff18d19756f8e825c6.
|
||||
This commit uses configfs_add_default_group to fix this problem.
|
||||
|
||||
Signed-off-by: Slawomir Stepien <sst@poczta.fm>
|
||||
|
||||
configfs: New of_overlay API
|
||||
|
||||
of: configfs: Use of_overlay_fdt_apply API call
|
||||
|
||||
The published API to the dynamic overlay application mechanism now
|
||||
takes a Flattened Device Tree blob as input so that it can manage the
|
||||
lifetime of the unflattened tree. Conveniently, the new API call -
|
||||
of_overlay_fdt_apply - is virtually a drop-in replacement for
|
||||
create_overlay, which can now be deleted.
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
---
|
||||
Documentation/devicetree/configfs-overlays.txt | 31 +
|
||||
drivers/of/Kconfig | 7 +
|
||||
Documentation/devicetree/configfs-overlays.txt | 31 ++
|
||||
drivers/of/Kconfig | 11 +
|
||||
drivers/of/Makefile | 1 +
|
||||
drivers/of/configfs.c | 290 ++++++++++
|
||||
4 files changed, 329 insertions(+)
|
||||
drivers/of/configfs.c | 277 ++++++++++
|
||||
4 files changed, 320 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/configfs-overlays.txt b/Documentation/devicetree/configfs-overlays.txt
|
||||
new file mode 100644
|
||||
@ -73,13 +100,17 @@ index 000000000000..5fa43e064307
|
||||
+intended to be used by hardware managers in the kernel, while the copy interface
|
||||
+make sense for developers (since it avoids problems with namespaces).
|
||||
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
|
||||
index da9826accb1b..52ffe3e8930f 100644
|
||||
index da9826accb1b..69e7c420b8f4 100644
|
||||
--- a/drivers/of/Kconfig
|
||||
+++ b/drivers/of/Kconfig
|
||||
@@ -102,4 +102,11 @@ config OF_OVERLAY
|
||||
@@ -102,4 +102,15 @@ config OF_OVERLAY
|
||||
config OF_NUMA
|
||||
bool
|
||||
|
||||
+config OF_DMA_DEFAULT_COHERENT
|
||||
+ # arches should select this if DMA is coherent by default for OF devices
|
||||
+ bool
|
||||
+
|
||||
+config OF_CONFIGFS
|
||||
+ bool "Device Tree Overlay ConfigFS interface"
|
||||
+ select CONFIGFS_FS
|
||||
@ -102,10 +133,10 @@ index eff624854575..61bd05f08ca1 100644
|
||||
obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
|
||||
diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
|
||||
new file mode 100644
|
||||
index 000000000000..5dd509e8fc87
|
||||
index 000000000000..1c30f35c3ca1
|
||||
--- /dev/null
|
||||
+++ b/drivers/of/configfs.c
|
||||
@@ -0,0 +1,290 @@
|
||||
@@ -0,0 +1,277 @@
|
||||
+/*
|
||||
+ * Configfs entries for device-tree
|
||||
+ *
|
||||
@ -148,21 +179,6 @@ index 000000000000..5dd509e8fc87
|
||||
+ int dtbo_size;
|
||||
+};
|
||||
+
|
||||
+static int create_overlay(struct cfs_overlay_item *overlay, void *blob, u32 blob_size)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ err = of_overlay_fdt_apply(blob, blob_size, &overlay->ov_id);
|
||||
+ if (err < 0) {
|
||||
+ pr_err("%s: Failed to create overlay (err=%d)\n",
|
||||
+ __func__, err);
|
||||
+ goto out_err;
|
||||
+ }
|
||||
+
|
||||
+out_err:
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static inline struct cfs_overlay_item *to_cfs_overlay_item(
|
||||
+ struct config_item *item)
|
||||
+{
|
||||
@ -203,7 +219,8 @@ index 000000000000..5dd509e8fc87
|
||||
+ if (err != 0)
|
||||
+ goto out_err;
|
||||
+
|
||||
+ err = create_overlay(overlay, (void *)overlay->fw->data, overlay->fw->size);
|
||||
+ err = of_overlay_fdt_apply((void *)overlay->fw->data,
|
||||
+ (u32)overlay->fw->size, &overlay->ov_id, NULL);
|
||||
+ if (err != 0)
|
||||
+ goto out_err;
|
||||
+
|
||||
@ -224,7 +241,7 @@ index 000000000000..5dd509e8fc87
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+
|
||||
+ return sprintf(page, "%s\n",
|
||||
+ overlay->ov_id >= 0 ? "applied" : "unapplied");
|
||||
+ overlay->ov_id > 0 ? "applied" : "unapplied");
|
||||
+}
|
||||
+
|
||||
+CONFIGFS_ATTR(cfs_overlay_item_, path);
|
||||
@ -276,7 +293,8 @@ index 000000000000..5dd509e8fc87
|
||||
+
|
||||
+ overlay->dtbo_size = count;
|
||||
+
|
||||
+ err = create_overlay(overlay, overlay->dtbo, overlay->dtbo_size);
|
||||
+ err = of_overlay_fdt_apply(overlay->dtbo, overlay->dtbo_size,
|
||||
+ &overlay->ov_id, NULL);
|
||||
+ if (err != 0)
|
||||
+ goto out_err;
|
||||
+
|
||||
@ -286,6 +304,7 @@ index 000000000000..5dd509e8fc87
|
||||
+ kfree(overlay->dtbo);
|
||||
+ overlay->dtbo = NULL;
|
||||
+ overlay->dtbo_size = 0;
|
||||
+ overlay->ov_id = 0;
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
@ -301,7 +320,7 @@ index 000000000000..5dd509e8fc87
|
||||
+{
|
||||
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
|
||||
+
|
||||
+ if (overlay->ov_id >= 0)
|
||||
+ if (overlay->ov_id > 0)
|
||||
+ of_overlay_remove(&overlay->ov_id);
|
||||
+ if (overlay->fw)
|
||||
+ release_firmware(overlay->fw);
|
||||
@ -329,7 +348,6 @@ index 000000000000..5dd509e8fc87
|
||||
+ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
|
||||
+ if (!overlay)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+ overlay->ov_id = -1;
|
||||
+
|
||||
+ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type);
|
||||
+ return &overlay->item;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user