diff mbox series

[2/2] platform/mowgli: Limit PHB0/(pec0) to gen3 speed

Message ID 20201209084054.25284-2-Lulu_Su@wistron.com
State Accepted
Headers show
Series [1/2] Revert "mowgli: Limit slot1 to Gen3 by default" | expand

Commit Message

Lulu Su Dec. 9, 2020, 8:40 a.m. UTC
From: LuluTHSu <Lulu_Su@wistron.com>

Use the method provided by Frederic:
Add the "ibm, maximum link speed" attribute to the PHB device tree at index 0.
The phb4.c code will looks for it and set up the link correctly.

Signed-off-by: LuluTHSu <Lulu_Su@wistron.com>
---
 platforms/astbmc/mowgli.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Frederic Barrat Dec. 9, 2020, 9:52 a.m. UTC | #1
On 09/12/2020 09:40, Lulu Su wrote:
> From: LuluTHSu <Lulu_Su@wistron.com>
> 
> Use the method provided by Frederic:
> Add the "ibm, maximum link speed" attribute to the PHB device tree at index 0.
> The phb4.c code will looks for it and set up the link correctly.
> 
> Signed-off-by: LuluTHSu <Lulu_Su@wistron.com>
> ---


Looks good to me :-)
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>



>   platforms/astbmc/mowgli.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/platforms/astbmc/mowgli.c b/platforms/astbmc/mowgli.c
> index 213d734..df83319 100644
> --- a/platforms/astbmc/mowgli.c
> +++ b/platforms/astbmc/mowgli.c
> @@ -49,6 +49,21 @@ static void vpd_dt_fixup(void)
>   	}
>   }
>   
> +static void phb0_fixup(void)
> +{
> +	struct dt_node *stk;
> +	u32 phb_index;
> +
> +	/* Limit PHB0/(pec0) to gen3 speed */
> +	dt_for_each_compatible(dt_root, stk, "ibm,power9-phb-stack") {
> +		phb_index = dt_prop_get_u32_def(stk, "ibm,phb-index", -1);
> +		if (phb_index == 0) {
> +			dt_check_del_prop(stk, "ibm,max-link-speed");
> +			dt_add_property_cells(stk, "ibm,max-link-speed", 3);
> +		}
> +	}
> +}
> +
>   static bool mowgli_probe(void)
>   {
>   	if (!dt_node_is_compatible(dt_root, "ibm,mowgli"))
> @@ -63,6 +78,7 @@ static bool mowgli_probe(void)
>   	vpd_dt_fixup();
>   
>   	slot_table_init(mowgli_phb_table);
> +	phb0_fixup();
>   
>   	return true;
>   }
>
diff mbox series

Patch

diff --git a/platforms/astbmc/mowgli.c b/platforms/astbmc/mowgli.c
index 213d734..df83319 100644
--- a/platforms/astbmc/mowgli.c
+++ b/platforms/astbmc/mowgli.c
@@ -49,6 +49,21 @@  static void vpd_dt_fixup(void)
 	}
 }
 
+static void phb0_fixup(void)
+{
+	struct dt_node *stk;
+	u32 phb_index;
+
+	/* Limit PHB0/(pec0) to gen3 speed */
+	dt_for_each_compatible(dt_root, stk, "ibm,power9-phb-stack") {
+		phb_index = dt_prop_get_u32_def(stk, "ibm,phb-index", -1);
+		if (phb_index == 0) {
+			dt_check_del_prop(stk, "ibm,max-link-speed");
+			dt_add_property_cells(stk, "ibm,max-link-speed", 3);
+		}
+	}
+}
+
 static bool mowgli_probe(void)
 {
 	if (!dt_node_is_compatible(dt_root, "ibm,mowgli"))
@@ -63,6 +78,7 @@  static bool mowgli_probe(void)
 	vpd_dt_fixup();
 
 	slot_table_init(mowgli_phb_table);
+	phb0_fixup();
 
 	return true;
 }