mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ata: sata_mv: enable SoC SATA LED presence indication
@ 2026-09-25 19:31 Carlos Junior
  2026-09-25 21:28 ` [PATCH v2] " Carlos Junior
  2026-09-28 13:28 ` [PATCH v3] " Carlos Junior
  0 siblings, 2 replies; 4+ messages in thread
From: Carlos Junior @ 2026-09-25 19:31 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel; +Cc: linux-ide, linux-kernel, Carlos Junior

Enable the SoC SATA LED controller in mv_soc_enable_leds().

Set the LED controller enable, device presence multiplexing, and
activity blink bits in the SoC SATA host-controller register. This
enables SATA device presence indication on boards using the SoC SATA
controller.

Signed-off-by: Carlos Junior <cjuniorfox@gmail.com>
---
 drivers/ata/sata_mv.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index d260f04e6..4a6a6dc7b 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -251,6 +251,7 @@ enum {
 	SOC_LED_CTRL		= 0x2c,
 	SOC_LED_CTRL_BLINK	= (1 << 0),	/* Active LED blink */
 	SOC_LED_CTRL_ACT_PRESENCE = (1 << 2),	/* Multiplex dev presence */
+	SOC_LED_CTRL_ENABLE	= (1 << 3),	/* Enable SATA LED control */
 						/*  with dev activity LED */
 
 	/* Shadow block registers */
@@ -3382,12 +3383,21 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
 	writel(m2, port_mmio + PHY_MODE2);
 }
 
-/* TODO: use the generic LED interface to configure the SATA Presence */
-/* & Acitivy LEDs on the board */
+/*
+ * Enable the SoC SATA LED controller and device presence
+ * indication on the board's SATA LEDs.
+ */
 static void mv_soc_enable_leds(struct mv_host_priv *hpriv,
 				      void __iomem *mmio)
 {
-	return;
+	void __iomem *hc_mmio;
+
+	hc_mmio = mv_hc_base(mmio, 0);
+
+	writel(SOC_LED_CTRL_ENABLE |
+		SOC_LED_CTRL_ACT_PRESENCE |
+		SOC_LED_CTRL_BLINK,
+		hc_mmio + SOC_LED_CTRL);
 }
 
 static void mv_soc_read_preamp(struct mv_host_priv *hpriv, int idx,
-- 
2.54.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] ata: sata_mv: enable SoC SATA LED presence indication
  2026-09-25 19:31 [PATCH] ata: sata_mv: enable SoC SATA LED presence indication Carlos Junior
@ 2026-09-25 21:28 ` Carlos Junior
  2026-09-28  6:51   ` Damien Le Moal
  2026-09-28 13:28 ` [PATCH v3] " Carlos Junior
  1 sibling, 1 reply; 4+ messages in thread
From: Carlos Junior @ 2026-09-25 21:28 UTC (permalink / raw)
  To: dlemoal; +Cc: cassel, linux-ide, linux-kernel, Carlos Junior

Enable the SoC SATA LED controller in mv_soc_enable_leds().

Set the LED controller enable and device presence multiplexing bits
in the SoC SATA host-controller register. This enables SATA device
presence indication on boards using the SoC SATA controller.

Signed-off-by: Carlos Junior <cjuniorfox@gmail.com>
---
Changes in v2:
- Do not initialize the SoC SATA LED blink bit; leave it to the
  existing NCQ LED blink handling.

 drivers/ata/sata_mv.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index d260f04e6..52e33485b 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -252,6 +252,7 @@ enum {
 	SOC_LED_CTRL_BLINK	= (1 << 0),	/* Active LED blink */
 	SOC_LED_CTRL_ACT_PRESENCE = (1 << 2),	/* Multiplex dev presence */
 						/*  with dev activity LED */
+	SOC_LED_CTRL_ENABLE	= (1 << 3),	/* Enable SATA LED control */
 
 	/* Shadow block registers */
 	SHD_BLK			= 0x100,
@@ -3382,12 +3383,20 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
 	writel(m2, port_mmio + PHY_MODE2);
 }
 
-/* TODO: use the generic LED interface to configure the SATA Presence */
-/* & Acitivy LEDs on the board */
+/*
+ * Enable the SoC SATA LED controller and device presence
+ * indication on the board's SATA LEDs.
+ */
 static void mv_soc_enable_leds(struct mv_host_priv *hpriv,
 				      void __iomem *mmio)
 {
-	return;
+	void __iomem *hc_mmio;
+
+	hc_mmio = mv_hc_base(mmio, 0);
+
+	writel(SOC_LED_CTRL_ENABLE |
+		SOC_LED_CTRL_ACT_PRESENCE,
+		hc_mmio + SOC_LED_CTRL);
 }
 
 static void mv_soc_read_preamp(struct mv_host_priv *hpriv, int idx,
-- 
2.54.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ata: sata_mv: enable SoC SATA LED presence indication
  2026-09-25 21:28 ` [PATCH v2] " Carlos Junior
@ 2026-09-28  6:51   ` Damien Le Moal
  0 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2026-09-28  6:51 UTC (permalink / raw)
  To: Carlos Junior; +Cc: cassel, linux-ide, linux-kernel

On 2026/09/25 23:28, Carlos Junior wrote:
> Enable the SoC SATA LED controller in mv_soc_enable_leds().
> 
> Set the LED controller enable and device presence multiplexing bits
> in the SoC SATA host-controller register. This enables SATA device
> presence indication on boards using the SoC SATA controller.
> 
> Signed-off-by: Carlos Junior <cjuniorfox@gmail.com>
> ---
> Changes in v2:
> - Do not initialize the SoC SATA LED blink bit; leave it to the
>   existing NCQ LED blink handling.
> 
>  drivers/ata/sata_mv.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index d260f04e6..52e33485b 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -252,6 +252,7 @@ enum {
>  	SOC_LED_CTRL_BLINK	= (1 << 0),	/* Active LED blink */
>  	SOC_LED_CTRL_ACT_PRESENCE = (1 << 2),	/* Multiplex dev presence */
>  						/*  with dev activity LED */
> +	SOC_LED_CTRL_ENABLE	= (1 << 3),	/* Enable SATA LED control */
>  
>  	/* Shadow block registers */
>  	SHD_BLK			= 0x100,
> @@ -3382,12 +3383,20 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
>  	writel(m2, port_mmio + PHY_MODE2);
>  }
>  
> -/* TODO: use the generic LED interface to configure the SATA Presence */
> -/* & Acitivy LEDs on the board */
> +/*
> + * Enable the SoC SATA LED controller and device presence
> + * indication on the board's SATA LEDs.
> + */
>  static void mv_soc_enable_leds(struct mv_host_priv *hpriv,
>  				      void __iomem *mmio)
>  {
> -	return;
> +	void __iomem *hc_mmio;
> +
> +	hc_mmio = mv_hc_base(mmio, 0);

This can be done in a single line with the declaration of the variable:

	void __iomem *hc_mmio = mv_hc_base(mmio, 0);

> +
> +	writel(SOC_LED_CTRL_ENABLE |
> +		SOC_LED_CTRL_ACT_PRESENCE,

No need to have this on 2 lines:

	writel(SOC_LED_CTRL_ENABLE | SOC_LED_CTRL_ACT_PRESENCE,
	       hc_mmio + SOC_LED_CTRL);

is nicer. And you can also get rid of the local variable:

	writel(SOC_LED_CTRL_ENABLE | SOC_LED_CTRL_ACT_PRESENCE,
	       mv_hc_base(mmio, 0) + SOC_LED_CTRL);

But if you prefer keeping the variable for readability, that's fine too.

With these nits fixed, feel free to add:

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

> +		hc_mmio + SOC_LED_CTRL);
>  }
>  
>  static void mv_soc_read_preamp(struct mv_host_priv *hpriv, int idx,


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3] ata: sata_mv: enable SoC SATA LED presence indication
  2026-09-25 19:31 [PATCH] ata: sata_mv: enable SoC SATA LED presence indication Carlos Junior
  2026-09-25 21:28 ` [PATCH v2] " Carlos Junior
@ 2026-09-28 13:28 ` Carlos Junior
  1 sibling, 0 replies; 4+ messages in thread
From: Carlos Junior @ 2026-09-28 13:28 UTC (permalink / raw)
  To: dlemoal; +Cc: cassel, linux-ide, linux-kernel, Carlos Junior

Enable the SoC SATA LED controller in mv_soc_enable_leds().

Set the LED controller enable and device presence multiplexing bits
in the SoC SATA host-controller register. This enables SATA device
presence indication on boards using the SoC SATA controller.

Signed-off-by: Carlos Junior <cjuniorfox@gmail.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
Changes in v3:
- Simplify the writel() as suggested by Damien Le Moal.
- Add Reviewed-by tag from Damien Le Moal.

Changes in v2:
- Do not initialize the SoC SATA LED blink bit; leave it to the
  existing NCQ LED blink handling.
---
 drivers/ata/sata_mv.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index d260f04e6..c408d04d9 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -252,6 +252,7 @@ enum {
 	SOC_LED_CTRL_BLINK	= (1 << 0),	/* Active LED blink */
 	SOC_LED_CTRL_ACT_PRESENCE = (1 << 2),	/* Multiplex dev presence */
 						/*  with dev activity LED */
+	SOC_LED_CTRL_ENABLE	= (1 << 3),	/* Enable SATA LED control */
 
 	/* Shadow block registers */
 	SHD_BLK			= 0x100,
@@ -3382,12 +3383,15 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
 	writel(m2, port_mmio + PHY_MODE2);
 }
 
-/* TODO: use the generic LED interface to configure the SATA Presence */
-/* & Acitivy LEDs on the board */
+/*
+ * Enable the SoC SATA LED controller and device presence
+ * indication on the board's SATA LEDs.
+ */
 static void mv_soc_enable_leds(struct mv_host_priv *hpriv,
 				      void __iomem *mmio)
 {
-	return;
+	writel(SOC_LED_CTRL_ENABLE | SOC_LED_CTRL_ACT_PRESENCE,
+	       mv_hc_base(mmio, 0) + SOC_LED_CTRL);
 }
 
 static void mv_soc_read_preamp(struct mv_host_priv *hpriv, int idx,
-- 
2.54.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-28 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25 19:31 [PATCH] ata: sata_mv: enable SoC SATA LED presence indication Carlos Junior
2026-09-25 21:28 ` [PATCH v2] " Carlos Junior
2026-09-28  6:51   ` Damien Le Moal
2026-09-28 13:28 ` [PATCH v3] " Carlos Junior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®