Restore LED triggers for each ATA port indicating disk activity in mvebu-edge

Signed-off-by: Christian Schoffit <sphpn@free.fr>
This commit is contained in:
Christian Schoffit
2023-09-18 10:20:22 +02:00
committed by Igor
parent 3eda27a77a
commit fbd0918101
2 changed files with 26 additions and 39 deletions

View File

@@ -1,25 +1,7 @@
From: Daniel Golle <daniel@makrotopia.org> Index: 6.1__mvebu__armhf/drivers/ata/Kconfig
Subject: libata: add ledtrig support ===================================================================
--- 6.1__mvebu__armhf.orig/drivers/ata/Kconfig
This adds a LED trigger for each ATA port indicating disk activity. +++ 6.1__mvebu__armhf/drivers/ata/Kconfig
As this is needed only on specific platforms (NAS SoCs and such),
these platforms should define ARCH_WANTS_LIBATA_LEDS if there
are boards with LED(s) intended to indicate ATA disk activity and
need the OS to take care of that.
In that way, if not selected, LED trigger support not will be
included in libata-core and both, codepaths and structures remain
untouched.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/ata/Kconfig | 16 ++++++++++++++++
drivers/ata/libata-core.c | 41 +++++++++++++++++++++++++++++++++++++++++
include/linux/libata.h | 9 +++++++++
3 files changed, 66 insertions(+)
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -67,6 +67,22 @@ config ATA_FORCE @@ -67,6 +67,22 @@ config ATA_FORCE
If unsure, say Y. If unsure, say Y.
@@ -43,9 +25,11 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
config ATA_ACPI config ATA_ACPI
bool "ATA ACPI Support" bool "ATA ACPI Support"
depends on ACPI depends on ACPI
--- a/drivers/ata/libata-core.c Index: 6.1__mvebu__armhf/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c ===================================================================
@@ -650,6 +650,19 @@ u64 ata_tf_read_block(const struct ata_t --- 6.1__mvebu__armhf.orig/drivers/ata/libata-core.c
+++ 6.1__mvebu__armhf/drivers/ata/libata-core.c
@@ -663,6 +663,19 @@ u64 ata_tf_read_block(const struct ata_t
return block; return block;
} }
@@ -64,18 +48,19 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+ +
/** /**
* ata_build_rw_tf - Build ATA taskfile for given read/write request * ata_build_rw_tf - Build ATA taskfile for given read/write request
* @tf: Target ATA taskfile * @qc: Metadata associated with the taskfile to build
@@ -4513,6 +4526,9 @@ struct ata_queued_cmd *ata_qc_new_init(s @@ -4813,6 +4826,10 @@ void ata_qc_issue(struct ata_queued_cmd
if (tag < 0) struct ata_link *link = qc->dev->link;
return NULL; u8 prot = qc->tf.protocol;
}
+#ifdef CONFIG_ATA_LEDS +#ifdef CONFIG_ATA_LEDS
+ ata_led_act(ap); + ata_led_act(ap);
+#endif +#endif
+
qc = __ata_qc_from_tag(ap, tag); /* Make sure only one non-NCQ command is outstanding. The
qc->tag = qc->hw_tag = tag; * check is skipped for old EH because it reuses active qc to
@@ -5291,6 +5307,9 @@ struct ata_port *ata_port_alloc(struct a * request ATAPI sense.
@@ -5328,6 +5345,9 @@ struct ata_port *ata_port_alloc(struct a
ap->stats.unhandled_irq = 1; ap->stats.unhandled_irq = 1;
ap->stats.idle_irq = 1; ap->stats.idle_irq = 1;
#endif #endif
@@ -85,7 +70,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
ata_sff_port_init(ap); ata_sff_port_init(ap);
return ap; return ap;
@@ -5326,6 +5345,12 @@ static void ata_host_release(struct kref @@ -5363,6 +5383,12 @@ static void ata_host_release(struct kref
kfree(ap->pmp_link); kfree(ap->pmp_link);
kfree(ap->slave_link); kfree(ap->slave_link);
@@ -98,7 +83,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
kfree(ap); kfree(ap);
host->ports[i] = NULL; host->ports[i] = NULL;
} }
@@ -5732,7 +5757,23 @@ int ata_host_register(struct ata_host *h @@ -5765,7 +5791,23 @@ int ata_host_register(struct ata_host *h
host->ports[i]->print_id = atomic_inc_return(&ata_print_id); host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
host->ports[i]->local_port_no = i + 1; host->ports[i]->local_port_no = i + 1;
} }
@@ -122,8 +107,10 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* Create associated sysfs transport objects */ /* Create associated sysfs transport objects */
for (i = 0; i < host->n_ports; i++) { for (i = 0; i < host->n_ports; i++) {
rc = ata_tport_add(host->dev,host->ports[i]); rc = ata_tport_add(host->dev,host->ports[i]);
--- a/include/linux/libata.h Index: 6.1__mvebu__armhf/include/linux/libata.h
+++ b/include/linux/libata.h ===================================================================
--- 6.1__mvebu__armhf.orig/include/linux/libata.h
+++ 6.1__mvebu__armhf/include/linux/libata.h
@@ -23,6 +23,9 @@ @@ -23,6 +23,9 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/sched.h> #include <linux/sched.h>
@@ -134,7 +121,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* /*
* Define if arch has non-standard setup. This is a _PCI_ standard * Define if arch has non-standard setup. This is a _PCI_ standard
@@ -882,6 +885,12 @@ struct ata_port { @@ -857,6 +860,12 @@ struct ata_port {
#ifdef CONFIG_ATA_ACPI #ifdef CONFIG_ATA_ACPI
struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
#endif #endif