[RFC v6 3/3] hw/arm: Integrate ASPEED OTP memory support into AST2600 SoCs

Kane Chen via posted 3 patches 4 months, 3 weeks ago
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>
[RFC v6 3/3] hw/arm: Integrate ASPEED OTP memory support into AST2600 SoCs
Posted by Kane Chen via 4 months, 3 weeks ago
From: Kane-Chen-AS <kane_chen@aspeedtech.com>

The has_otpmem attribute is enabled in the SBC subclasses for AST2600
to control the presence of OTP support per SoC type.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
 hw/arm/aspeed_ast2600.c      | 2 +-
 hw/misc/aspeed_sbc.c         | 2 ++
 include/hw/misc/aspeed_sbc.h | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index d12707f0ab..59ffd41a4a 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -261,7 +261,7 @@ static void aspeed_soc_ast2600_init(Object *obj)
 
     object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C);
 
-    object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_SBC);
+    object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_AST2600_SBC);
 
     object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
     object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE);
diff --git a/hw/misc/aspeed_sbc.c b/hw/misc/aspeed_sbc.c
index 3bc5e37c6b..f1e8747edd 100644
--- a/hw/misc/aspeed_sbc.c
+++ b/hw/misc/aspeed_sbc.c
@@ -254,8 +254,10 @@ static const TypeInfo aspeed_sbc_info = {
 static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    AspeedSBCClass *sc = ASPEED_SBC_CLASS(klass);
 
     dc->desc = "AST2600 Secure Boot Controller";
+    sc->has_otpmem = true;
 }
 
 static const TypeInfo aspeed_ast2600_sbc_info = {
diff --git a/include/hw/misc/aspeed_sbc.h b/include/hw/misc/aspeed_sbc.h
index 3191c6eb87..f1e6f8148c 100644
--- a/include/hw/misc/aspeed_sbc.h
+++ b/include/hw/misc/aspeed_sbc.h
@@ -43,6 +43,8 @@ struct AspeedSBCState {
 
 struct AspeedSBCClass {
     SysBusDeviceClass parent_class;
+
+    bool has_otpmem;
 };
 
 #endif /* ASPEED_SBC_H */
-- 
2.43.0
Re: [RFC v6 3/3] hw/arm: Integrate ASPEED OTP memory support into AST2600 SoCs
Posted by Cédric Le Goater 4 months, 3 weeks ago
On 6/24/25 04:22, Kane Chen wrote:
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> 
> The has_otpmem attribute is enabled in the SBC subclasses for AST2600
> to control the presence of OTP support per SoC type.
> 
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> ---
>   hw/arm/aspeed_ast2600.c      | 2 +-
>   hw/misc/aspeed_sbc.c         | 2 ++
>   include/hw/misc/aspeed_sbc.h | 2 ++
>   3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
> index d12707f0ab..59ffd41a4a 100644
> --- a/hw/arm/aspeed_ast2600.c
> +++ b/hw/arm/aspeed_ast2600.c
> @@ -261,7 +261,7 @@ static void aspeed_soc_ast2600_init(Object *obj)
>   
>       object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C);
>   
> -    object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_SBC);
> +    object_initialize_child(obj, "sbc", &s->sbc, TYPE_ASPEED_AST2600_SBC);

I see that TYPE_ASPEED_AST2600_SBC was defined but never used :/

>   
>       object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
>       object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE);
> diff --git a/hw/misc/aspeed_sbc.c b/hw/misc/aspeed_sbc.c
> index 3bc5e37c6b..f1e8747edd 100644
> --- a/hw/misc/aspeed_sbc.c
> +++ b/hw/misc/aspeed_sbc.c
> @@ -254,8 +254,10 @@ static const TypeInfo aspeed_sbc_info = {
>   static void aspeed_ast2600_sbc_class_init(ObjectClass *klass, const void *data)
>   {
>       DeviceClass *dc = DEVICE_CLASS(klass);
> +    AspeedSBCClass *sc = ASPEED_SBC_CLASS(klass);
>   
>       dc->desc = "AST2600 Secure Boot Controller";
> +    sc->has_otpmem = true;
>   }
>   
>   static const TypeInfo aspeed_ast2600_sbc_info = {
> diff --git a/include/hw/misc/aspeed_sbc.h b/include/hw/misc/aspeed_sbc.h
> index 3191c6eb87..f1e6f8148c 100644
> --- a/include/hw/misc/aspeed_sbc.h
> +++ b/include/hw/misc/aspeed_sbc.h
> @@ -43,6 +43,8 @@ struct AspeedSBCState {
>   
>   struct AspeedSBCClass {
>       SysBusDeviceClass parent_class;
> +
> +    bool has_otpmem;

This change should be in the previous patch.


Thanks,

C.


>   };
>   
>   #endif /* ASPEED_SBC_H */