mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] arm: mecsbc: fixup /regulator-sd device tree node
@ 2024-04-05 10:12 Sascha Hauer
  2024-04-05 11:46 ` Ahmad Fatoum
  2024-04-08  6:50 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-04-05 10:12 UTC (permalink / raw)
  To: Barebox List

The MECSBC prototype board has a bug which makes the 1.8V SD mode
unusable. Add a fixup which sets the regulator-min-microvolt property of
the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/protonic-mecsbc/board.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boards/protonic-mecsbc/board.c b/arch/arm/boards/protonic-mecsbc/board.c
index 3ba8fb8d1c..56f7ca393a 100644
--- a/arch/arm/boards/protonic-mecsbc/board.c
+++ b/arch/arm/boards/protonic-mecsbc/board.c
@@ -90,6 +90,24 @@ static void mecsbc_process_adc(struct device *dev)
 	pr_info("VIN = %d V\n", mecsbc_get_vin_mv() / 1000);
 }
 
+static int mecsbc_sd_of_fixup(struct device_node *root, void *context)
+{
+	struct device *dev = context;
+	struct device_node *np;
+
+	dev_info(dev, "Fixing up /regulator-sd\n");
+
+	np = of_find_node_by_path_from(root, "/regulator-sd");
+	if (!np) {
+		dev_err(dev, "Cannot find /regulator-sd node\n");
+		return 0;
+	}
+
+	of_property_write_u32(np, "regulator-min-microvolt", 3300000);
+
+	return 0;
+}
+
 static int mecsbc_of_fixup_hwrev(struct device *dev)
 {
 	const char *compat;
@@ -103,6 +121,9 @@ static int mecsbc_of_fixup_hwrev(struct device *dev)
 
 	free(buf);
 
+	if (mecsbc_data.hw_id == 0 && mecsbc_data.hw_rev == 0)
+		of_register_fixup(mecsbc_sd_of_fixup, dev);
+
 	return 0;
 }
 
-- 
2.39.2




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

* Re: [PATCH] arm: mecsbc: fixup /regulator-sd device tree node
  2024-04-05 10:12 [PATCH] arm: mecsbc: fixup /regulator-sd device tree node Sascha Hauer
@ 2024-04-05 11:46 ` Ahmad Fatoum
  2024-04-05 12:13   ` Sascha Hauer
  2024-04-08  6:50 ` Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2024-04-05 11:46 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List

Hello Sascha,

On 05.04.24 12:12, Sascha Hauer wrote:
> The MECSBC prototype board has a bug which makes the 1.8V SD mode
> unusable. Add a fixup which sets the regulator-min-microvolt property of
> the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.

Isn't that what the MMC no-1-8-v device tree property is for?

Cheers,
Ahmad

> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/boards/protonic-mecsbc/board.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/arch/arm/boards/protonic-mecsbc/board.c b/arch/arm/boards/protonic-mecsbc/board.c
> index 3ba8fb8d1c..56f7ca393a 100644
> --- a/arch/arm/boards/protonic-mecsbc/board.c
> +++ b/arch/arm/boards/protonic-mecsbc/board.c
> @@ -90,6 +90,24 @@ static void mecsbc_process_adc(struct device *dev)
>  	pr_info("VIN = %d V\n", mecsbc_get_vin_mv() / 1000);
>  }
>  
> +static int mecsbc_sd_of_fixup(struct device_node *root, void *context)
> +{
> +	struct device *dev = context;
> +	struct device_node *np;
> +
> +	dev_info(dev, "Fixing up /regulator-sd\n");
> +
> +	np = of_find_node_by_path_from(root, "/regulator-sd");
> +	if (!np) {
> +		dev_err(dev, "Cannot find /regulator-sd node\n");
> +		return 0;
> +	}
> +
> +	of_property_write_u32(np, "regulator-min-microvolt", 3300000);
> +
> +	return 0;
> +}
> +
>  static int mecsbc_of_fixup_hwrev(struct device *dev)
>  {
>  	const char *compat;
> @@ -103,6 +121,9 @@ static int mecsbc_of_fixup_hwrev(struct device *dev)
>  
>  	free(buf);
>  
> +	if (mecsbc_data.hw_id == 0 && mecsbc_data.hw_rev == 0)
> +		of_register_fixup(mecsbc_sd_of_fixup, dev);
> +
>  	return 0;
>  }
>  

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

* Re: [PATCH] arm: mecsbc: fixup /regulator-sd device tree node
  2024-04-05 11:46 ` Ahmad Fatoum
@ 2024-04-05 12:13   ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-04-05 12:13 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Barebox List

On Fri, Apr 05, 2024 at 01:46:26PM +0200, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 05.04.24 12:12, Sascha Hauer wrote:
> > The MECSBC prototype board has a bug which makes the 1.8V SD mode
> > unusable. Add a fixup which sets the regulator-min-microvolt property of
> > the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.
> 
> Isn't that what the MMC no-1-8-v device tree property is for?

Although it's described in mmc-controller.yaml this is not a generic property.
Only SDHCI based controllers evaluate this property (which the affected
controller here isn't)

Sascha

> 
> Cheers,
> Ahmad
> 
> > 
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  arch/arm/boards/protonic-mecsbc/board.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> > 
> > diff --git a/arch/arm/boards/protonic-mecsbc/board.c b/arch/arm/boards/protonic-mecsbc/board.c
> > index 3ba8fb8d1c..56f7ca393a 100644
> > --- a/arch/arm/boards/protonic-mecsbc/board.c
> > +++ b/arch/arm/boards/protonic-mecsbc/board.c
> > @@ -90,6 +90,24 @@ static void mecsbc_process_adc(struct device *dev)
> >  	pr_info("VIN = %d V\n", mecsbc_get_vin_mv() / 1000);
> >  }
> >  
> > +static int mecsbc_sd_of_fixup(struct device_node *root, void *context)
> > +{
> > +	struct device *dev = context;
> > +	struct device_node *np;
> > +
> > +	dev_info(dev, "Fixing up /regulator-sd\n");
> > +
> > +	np = of_find_node_by_path_from(root, "/regulator-sd");
> > +	if (!np) {
> > +		dev_err(dev, "Cannot find /regulator-sd node\n");
> > +		return 0;
> > +	}
> > +
> > +	of_property_write_u32(np, "regulator-min-microvolt", 3300000);
> > +
> > +	return 0;
> > +}
> > +
> >  static int mecsbc_of_fixup_hwrev(struct device *dev)
> >  {
> >  	const char *compat;
> > @@ -103,6 +121,9 @@ static int mecsbc_of_fixup_hwrev(struct device *dev)
> >  
> >  	free(buf);
> >  
> > +	if (mecsbc_data.hw_id == 0 && mecsbc_data.hw_rev == 0)
> > +		of_register_fixup(mecsbc_sd_of_fixup, dev);
> > +
> >  	return 0;
> >  }
> >  
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [PATCH] arm: mecsbc: fixup /regulator-sd device tree node
  2024-04-05 10:12 [PATCH] arm: mecsbc: fixup /regulator-sd device tree node Sascha Hauer
  2024-04-05 11:46 ` Ahmad Fatoum
@ 2024-04-08  6:50 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-04-08  6:50 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Fri, 05 Apr 2024 12:12:50 +0200, Sascha Hauer wrote:
> The MECSBC prototype board has a bug which makes the 1.8V SD mode
> unusable. Add a fixup which sets the regulator-min-microvolt property of
> the SD regulator to 3.3V to prevent the Kernel from going into 1.8V.
> 
> 

Applied, thanks!

[1/1] arm: mecsbc: fixup /regulator-sd device tree node
      https://git.pengutronix.de/cgit/barebox/commit/?id=004911504554 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-04-08  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-05 10:12 [PATCH] arm: mecsbc: fixup /regulator-sd device tree node Sascha Hauer
2024-04-05 11:46 ` Ahmad Fatoum
2024-04-05 12:13   ` Sascha Hauer
2024-04-08  6:50 ` Sascha Hauer

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