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>
Subject: libata: add ledtrig support
This adds a LED trigger for each ATA port indicating disk activity.
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
Index: 6.1__mvebu__armhf/drivers/ata/Kconfig
===================================================================
--- 6.1__mvebu__armhf.orig/drivers/ata/Kconfig
+++ 6.1__mvebu__armhf/drivers/ata/Kconfig
@@ -67,6 +67,22 @@ config ATA_FORCE
If unsure, say Y.
@@ -43,9 +25,11 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
config ATA_ACPI
bool "ATA ACPI Support"
depends on ACPI
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -650,6 +650,19 @@ u64 ata_tf_read_block(const struct ata_t
Index: 6.1__mvebu__armhf/drivers/ata/libata-core.c
===================================================================
--- 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;
}
@@ -64,18 +48,19 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+
/**
* ata_build_rw_tf - Build ATA taskfile for given read/write request
* @tf: Target ATA taskfile
@@ -4513,6 +4526,9 @@ struct ata_queued_cmd *ata_qc_new_init(s
if (tag < 0)
return NULL;
}
* @qc: Metadata associated with the taskfile to build
@@ -4813,6 +4826,10 @@ void ata_qc_issue(struct ata_queued_cmd
struct ata_link *link = qc->dev->link;
u8 prot = qc->tf.protocol;
+#ifdef CONFIG_ATA_LEDS
+ ata_led_act(ap);
+#endif
qc = __ata_qc_from_tag(ap, tag);
qc->tag = qc->hw_tag = tag;
@@ -5291,6 +5307,9 @@ struct ata_port *ata_port_alloc(struct a
+
/* Make sure only one non-NCQ command is outstanding. The
* check is skipped for old EH because it reuses active qc to
* request ATAPI sense.
@@ -5328,6 +5345,9 @@ struct ata_port *ata_port_alloc(struct a
ap->stats.unhandled_irq = 1;
ap->stats.idle_irq = 1;
#endif
@@ -85,7 +70,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
ata_sff_port_init(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->slave_link);
@@ -98,7 +83,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
kfree(ap);
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]->local_port_no = i + 1;
}
@@ -122,8 +107,10 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* Create associated sysfs transport objects */
for (i = 0; i < host->n_ports; i++) {
rc = ata_tport_add(host->dev,host->ports[i]);
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
Index: 6.1__mvebu__armhf/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 @@
#include <linux/cdrom.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
@@ -882,6 +885,12 @@ struct ata_port {
@@ -857,6 +860,12 @@ struct ata_port {
#ifdef CONFIG_ATA_ACPI
struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
#endif