[PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset

Andrew Jeffery posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260818-dev-ast2600-hw-prot-key-reset-v1-1-5dc3de64c247@codeconstruct.com.au
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>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>
hw/misc/aspeed_scu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Andrew Jeffery 1 month, 1 week ago
Currently, booting Linux on the ast2600-evb machine via -kernel results
in a lot of warnings about failing to apply pinmux configuration when
binding drivers:

    [    7.339307][    T1] Creating 5 MTD partitions on "bmc":
    [    7.340402][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
    [    7.513755][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
    [    7.664219][    T1] 0x000000100000-0x000000a00000 : "kernel"
    [    7.826974][    T1] 0x000000a00000-0x000002a00000 : "rofs"
    [    8.026666][    T1] 0x000002a00000-0x000004000000 : "rwfs"
    [    8.201612][    T1] spi-aspeed-smc 1e630000.spi: error -EPERM: Error applying setting, reverse things back
    [    8.370835][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
    [    8.371131][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
    [    8.371500][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
    [    8.766797][    T1] mdio-aspeed 1e650000.mdio: error -EPERM: Error applying setting, reverse things back
    [    8.906008][    T1] mdio-aspeed 1e650008.mdio: error -EPERM: Error applying setting, reverse things back
    [    9.039240][    T1] mdio-aspeed 1e650010.mdio: error -EPERM: Error applying setting, reverse things back
    [    9.147942][    T1] mdio-aspeed 1e650018.mdio: error -EPERM: Error applying setting, reverse things back

The pinmux configuration fails because the SCU is not unlocked.

Set both SCU protection keys for the AST2600. Further, set them
such that they behave accordance with the read value documented
by the datasheet. The new arrangement now upholds the comment in
hw/arm/aspeed.c regarding passing -kernel on the qemu command-line.

    [    7.568170][    T1] Creating 5 MTD partitions on "bmc":
    [    7.569330][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
    [    7.740372][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
    [    7.883570][    T1] 0x000000100000-0x000000a00000 : "kernel"
    [    8.041004][    T1] 0x000000a00000-0x000002a00000 : "rofs"
    [    8.196824][    T1] 0x000002a00000-0x000004000000 : "rwfs"
    [    8.547037][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
    [    8.547320][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
    [    8.547642][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
    [    9.494235][    T1] ftgmac100 1e660000.ethernet: Read MAC address 52:54:00:12:34:56 from chip
    [    9.531186][    T1] RTL8211E Gigabit Ethernet 1e650000.mdio-1:00: attached PHY driver (mii_bus:phy_addr=1e650000.mdio-1:00,

Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
---
I ran into this issue while improving test coverage in my patch review
process.
---
 hw/misc/aspeed_scu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
index ca93c3699d81..1e3db6d03f91 100644
--- a/hw/misc/aspeed_scu.c
+++ b/hw/misc/aspeed_scu.c
@@ -821,7 +821,8 @@ static void aspeed_ast2600_scu_reset_hold(Object *obj, ResetType type)
     s->regs[AST2600_SILICON_REV2] = s->silicon_rev;
     s->regs[AST2600_HW_STRAP1] = s->hw_strap1;
     s->regs[AST2600_HW_STRAP2] = s->hw_strap2;
-    s->regs[PROT_KEY] = s->hw_prot_key;
+    s->regs[AST2600_PROT_KEY] = s->hw_prot_key == ASPEED_SCU_PROT_KEY;
+    s->regs[AST2600_PROT_KEY2] = s->hw_prot_key == ASPEED_SCU_PROT_KEY;
 }
 
 static void aspeed_2600_scu_class_init(ObjectClass *klass, const void *data)

---
base-commit: 9696bf5dc5a5bf0b4a9d05b6cdfe5f13990f97aa
change-id: 20260818-dev-ast2600-hw-prot-key-reset-e68eb9f49ee9

Best regards,
--  
Andrew Jeffery <andrew@codeconstruct.com.au>
Re: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Philippe Mathieu-Daudé 1 month, 1 week ago
On 18/8/26 03:43, Andrew Jeffery wrote:
> Currently, booting Linux on the ast2600-evb machine via -kernel results
> in a lot of warnings about failing to apply pinmux configuration when
> binding drivers:
> 
>      [    7.339307][    T1] Creating 5 MTD partitions on "bmc":
>      [    7.340402][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>      [    7.513755][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
>      [    7.664219][    T1] 0x000000100000-0x000000a00000 : "kernel"
>      [    7.826974][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>      [    8.026666][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>      [    8.201612][    T1] spi-aspeed-smc 1e630000.spi: error -EPERM: Error applying setting, reverse things back
>      [    8.370835][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
>      [    8.371131][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
>      [    8.371500][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
>      [    8.766797][    T1] mdio-aspeed 1e650000.mdio: error -EPERM: Error applying setting, reverse things back
>      [    8.906008][    T1] mdio-aspeed 1e650008.mdio: error -EPERM: Error applying setting, reverse things back
>      [    9.039240][    T1] mdio-aspeed 1e650010.mdio: error -EPERM: Error applying setting, reverse things back
>      [    9.147942][    T1] mdio-aspeed 1e650018.mdio: error -EPERM: Error applying setting, reverse things back
> 
> The pinmux configuration fails because the SCU is not unlocked.
> 
> Set both SCU protection keys for the AST2600. Further, set them
> such that they behave accordance with the read value documented
> by the datasheet. The new arrangement now upholds the comment in
> hw/arm/aspeed.c regarding passing -kernel on the qemu command-line.
> 
>      [    7.568170][    T1] Creating 5 MTD partitions on "bmc":
>      [    7.569330][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>      [    7.740372][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
>      [    7.883570][    T1] 0x000000100000-0x000000a00000 : "kernel"
>      [    8.041004][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>      [    8.196824][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>      [    8.547037][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
>      [    8.547320][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
>      [    8.547642][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
>      [    9.494235][    T1] ftgmac100 1e660000.ethernet: Read MAC address 52:54:00:12:34:56 from chip
>      [    9.531186][    T1] RTL8211E Gigabit Ethernet 1e650000.mdio-1:00: attached PHY driver (mii_bus:phy_addr=1e650000.mdio-1:00,
> 
> Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
> ---
> I ran into this issue while improving test coverage in my patch review
> process.
> ---
>   hw/misc/aspeed_scu.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Cc: qemu-stable@nongnu.org
Fixes: e09cf36321f ("hw: aspeed_scu: Add AST2600 support")
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

Re: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Cédric Le Goater 1 month, 1 week ago
On 8/19/26 02:06, Philippe Mathieu-Daudé wrote:
> On 18/8/26 03:43, Andrew Jeffery wrote:
>> Currently, booting Linux on the ast2600-evb machine via -kernel results
>> in a lot of warnings about failing to apply pinmux configuration when
>> binding drivers:
>>
>>      [    7.339307][    T1] Creating 5 MTD partitions on "bmc":
>>      [    7.340402][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>>      [    7.513755][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
>>      [    7.664219][    T1] 0x000000100000-0x000000a00000 : "kernel"
>>      [    7.826974][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>>      [    8.026666][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>>      [    8.201612][    T1] spi-aspeed-smc 1e630000.spi: error -EPERM: Error applying setting, reverse things back
>>      [    8.370835][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
>>      [    8.371131][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
>>      [    8.371500][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
>>      [    8.766797][    T1] mdio-aspeed 1e650000.mdio: error -EPERM: Error applying setting, reverse things back
>>      [    8.906008][    T1] mdio-aspeed 1e650008.mdio: error -EPERM: Error applying setting, reverse things back
>>      [    9.039240][    T1] mdio-aspeed 1e650010.mdio: error -EPERM: Error applying setting, reverse things back
>>      [    9.147942][    T1] mdio-aspeed 1e650018.mdio: error -EPERM: Error applying setting, reverse things back
>>
>> The pinmux configuration fails because the SCU is not unlocked.
>>
>> Set both SCU protection keys for the AST2600. Further, set them
>> such that they behave accordance with the read value documented
>> by the datasheet. The new arrangement now upholds the comment in
>> hw/arm/aspeed.c regarding passing -kernel on the qemu command-line.
>>
>>      [    7.568170][    T1] Creating 5 MTD partitions on "bmc":
>>      [    7.569330][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>>      [    7.740372][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
>>      [    7.883570][    T1] 0x000000100000-0x000000a00000 : "kernel"
>>      [    8.041004][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>>      [    8.196824][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>>      [    8.547037][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
>>      [    8.547320][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
>>      [    8.547642][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
>>      [    9.494235][    T1] ftgmac100 1e660000.ethernet: Read MAC address 52:54:00:12:34:56 from chip
>>      [    9.531186][    T1] RTL8211E Gigabit Ethernet 1e650000.mdio-1:00: attached PHY driver (mii_bus:phy_addr=1e650000.mdio-1:00,
>>
>> Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
>> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
>> ---
>> I ran into this issue while improving test coverage in my patch review
>> process.
>> ---
>>   hw/misc/aspeed_scu.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Cc: qemu-stable@nongnu.org
> Fixes: e09cf36321f ("hw: aspeed_scu: Add AST2600 support")

something is wrong with the above hash ?

Thanks,

C.

> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>


Re: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Philippe Mathieu-Daudé 1 month, 1 week ago
On 2026-08-19 9:17, Cédric Le Goater wrote:
> On 8/19/26 02:06, Philippe Mathieu-Daudé wrote:
>> On 18/8/26 03:43, Andrew Jeffery wrote:
>>> Currently, booting Linux on the ast2600-evb machine via -kernel results
>>> in a lot of warnings about failing to apply pinmux configuration when
>>> binding drivers:
[...]

>>> Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
>>> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
>>> ---
>>> I ran into this issue while improving test coverage in my patch review
>>> process.
>>> ---
>>>   hw/misc/aspeed_scu.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Cc: qemu-stable@nongnu.org
>> Fixes: e09cf36321f ("hw: aspeed_scu: Add AST2600 support")
> 
> something is wrong with the above hash ?

Nop I just missed it.

> 
> Thanks,
> 
> C.
> 
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> 


Re: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Cédric Le Goater 1 month, 1 week ago
On 8/18/26 03:43, Andrew Jeffery wrote:
> Currently, booting Linux on the ast2600-evb machine via -kernel results
> in a lot of warnings about failing to apply pinmux configuration when
> binding drivers:
> 
>      [    7.339307][    T1] Creating 5 MTD partitions on "bmc":
>      [    7.340402][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>      [    7.513755][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
>      [    7.664219][    T1] 0x000000100000-0x000000a00000 : "kernel"
>      [    7.826974][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>      [    8.026666][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>      [    8.201612][    T1] spi-aspeed-smc 1e630000.spi: error -EPERM: Error applying setting, reverse things back
>      [    8.370835][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
>      [    8.371131][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
>      [    8.371500][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
>      [    8.766797][    T1] mdio-aspeed 1e650000.mdio: error -EPERM: Error applying setting, reverse things back
>      [    8.906008][    T1] mdio-aspeed 1e650008.mdio: error -EPERM: Error applying setting, reverse things back
>      [    9.039240][    T1] mdio-aspeed 1e650010.mdio: error -EPERM: Error applying setting, reverse things back
>      [    9.147942][    T1] mdio-aspeed 1e650018.mdio: error -EPERM: Error applying setting, reverse things back
> 
> The pinmux configuration fails because the SCU is not unlocked.
> 
> Set both SCU protection keys for the AST2600. Further, set them
> such that they behave accordance with the read value documented
> by the datasheet. The new arrangement now upholds the comment in
> hw/arm/aspeed.c regarding passing -kernel on the qemu command-line.
> 
>      [    7.568170][    T1] Creating 5 MTD partitions on "bmc":
>      [    7.569330][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>      [    7.740372][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
>      [    7.883570][    T1] 0x000000100000-0x000000a00000 : "kernel"
>      [    8.041004][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>      [    8.196824][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>      [    8.547037][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
>      [    8.547320][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
>      [    8.547642][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
>      [    9.494235][    T1] ftgmac100 1e660000.ethernet: Read MAC address 52:54:00:12:34:56 from chip
>      [    9.531186][    T1] RTL8211E Gigabit Ethernet 1e650000.mdio-1:00: attached PHY driver (mii_bus:phy_addr=1e650000.mdio-1:00,
> 
> Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
> ---
> I ran into this issue while improving test coverage in my patch review
> process.
> ---
>   hw/misc/aspeed_scu.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
> index ca93c3699d81..1e3db6d03f91 100644
> --- a/hw/misc/aspeed_scu.c
> +++ b/hw/misc/aspeed_scu.c
> @@ -821,7 +821,8 @@ static void aspeed_ast2600_scu_reset_hold(Object *obj, ResetType type)
>       s->regs[AST2600_SILICON_REV2] = s->silicon_rev;
>       s->regs[AST2600_HW_STRAP1] = s->hw_strap1;
>       s->regs[AST2600_HW_STRAP2] = s->hw_strap2;
> -    s->regs[PROT_KEY] = s->hw_prot_key;
> +    s->regs[AST2600_PROT_KEY] = s->hw_prot_key == ASPEED_SCU_PROT_KEY;
> +    s->regs[AST2600_PROT_KEY2] = s->hw_prot_key == ASPEED_SCU_PROT_KEY;
>   }
>   
>   static void aspeed_2600_scu_class_init(ObjectClass *klass, const void *data)
> 
> ---
> base-commit: 9696bf5dc5a5bf0b4a9d05b6cdfe5f13990f97aa
> change-id: 20260818-dev-ast2600-hw-prot-key-reset-e68eb9f49ee9
> 
> Best regards,
> --
> Andrew Jeffery <andrew@codeconstruct.com.au>
> 

Applied to

     https://github.com/legoater/qemu aspeed-next

Thanks,

C.
Re: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Andrew Jeffery 1 month, 1 week ago
On Tue, 2026-08-18 at 23:20 +0200, Cédric Le Goater wrote:
> On 8/18/26 03:43, Andrew Jeffery wrote:
> > Currently, booting Linux on the ast2600-evb machine via -kernel results
> > in a lot of warnings about failing to apply pinmux configuration when
> > binding drivers:
> > 
> >      [    7.339307][    T1] Creating 5 MTD partitions on "bmc":
> >      [    7.340402][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
> >      [    7.513755][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
> >      [    7.664219][    T1] 0x000000100000-0x000000a00000 : "kernel"
> >      [    7.826974][    T1] 0x000000a00000-0x000002a00000 : "rofs"
> >      [    8.026666][    T1] 0x000002a00000-0x000004000000 : "rwfs"
> >      [    8.201612][    T1] spi-aspeed-smc 1e630000.spi: error -EPERM: Error applying setting, reverse things back
> >      [    8.370835][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
> >      [    8.371131][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
> >      [    8.371500][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
> >      [    8.766797][    T1] mdio-aspeed 1e650000.mdio: error -EPERM: Error applying setting, reverse things back
> >      [    8.906008][    T1] mdio-aspeed 1e650008.mdio: error -EPERM: Error applying setting, reverse things back
> >      [    9.039240][    T1] mdio-aspeed 1e650010.mdio: error -EPERM: Error applying setting, reverse things back
> >      [    9.147942][    T1] mdio-aspeed 1e650018.mdio: error -EPERM: Error applying setting, reverse things back
> > 
> > The pinmux configuration fails because the SCU is not unlocked.
> > 
> > Set both SCU protection keys for the AST2600. Further, set them
> > such that they behave accordance with the read value documented
> > by the datasheet. The new arrangement now upholds the comment in
> > hw/arm/aspeed.c regarding passing -kernel on the qemu command-line.
> > 
> >      [    7.568170][    T1] Creating 5 MTD partitions on "bmc":
> >      [    7.569330][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
> >      [    7.740372][    T1] 0x0000000e0000-0x000000100000 : "u-boot-env"
> >      [    7.883570][    T1] 0x000000100000-0x000000a00000 : "kernel"
> >      [    8.041004][    T1] 0x000000a00000-0x000002a00000 : "rofs"
> >      [    8.196824][    T1] 0x000002a00000-0x000004000000 : "rwfs"
> >      [    8.547037][    T1] spi-aspeed-smc 1e630000.spi: Calibration area too uniform, using low speed
> >      [    8.547320][    T1] spi-aspeed-smc 1e630000.spi: Force to dts configuration 100000kHz.
> >      [    8.547642][    T1] spi-aspeed-smc 1e630000.spi: CE0 read buswidth:4 [0x406c0741]
> >      [    9.494235][    T1] ftgmac100 1e660000.ethernet: Read MAC address 52:54:00:12:34:56 from chip
> >      [    9.531186][    T1] RTL8211E Gigabit Ethernet 1e650000.mdio-1:00: attached PHY driver (mii_bus:phy_addr=1e650000.mdio-1:00,
> > 
> > Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
> > Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
> > ---
> > I ran into this issue while improving test coverage in my patch review
> > process.
> > ---
> >   hw/misc/aspeed_scu.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c
> > index ca93c3699d81..1e3db6d03f91 100644
> > --- a/hw/misc/aspeed_scu.c
> > +++ b/hw/misc/aspeed_scu.c
> > @@ -821,7 +821,8 @@ static void aspeed_ast2600_scu_reset_hold(Object *obj, ResetType type)
> >       s->regs[AST2600_SILICON_REV2] = s->silicon_rev;
> >       s->regs[AST2600_HW_STRAP1] = s->hw_strap1;
> >       s->regs[AST2600_HW_STRAP2] = s->hw_strap2;
> > -    s->regs[PROT_KEY] = s->hw_prot_key;
> > +    s->regs[AST2600_PROT_KEY] = s->hw_prot_key == ASPEED_SCU_PROT_KEY;
> > +    s->regs[AST2600_PROT_KEY2] = s->hw_prot_key == ASPEED_SCU_PROT_KEY;
> >   }
> >   
> >   static void aspeed_2600_scu_class_init(ObjectClass *klass, const void *data)
> > 
> > ---
> > base-commit: 9696bf5dc5a5bf0b4a9d05b6cdfe5f13990f97aa
> > change-id: 20260818-dev-ast2600-hw-prot-key-reset-e68eb9f49ee9
> > 
> > Best regards,
> > --
> > Andrew Jeffery <andrew@codeconstruct.com.au>
> > 
> 
> Applied to
> 
>      https://github.com/legoater/qemu aspeed-next
> 
> Thanks,
> 
> C.

Thanks Cédric!
RE: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key registers on reset
Posted by Jamin Lin 1 month, 1 week ago
> Subject: [PATCH] hw/misc/aspeed_scu: Set both AST2600 protection key
> registers on reset
> 
> Currently, booting Linux on the ast2600-evb machine via -kernel results in a lot
> of warnings about failing to apply pinmux configuration when binding drivers:
> 
>     [    7.339307][    T1] Creating 5 MTD partitions on "bmc":
>     [    7.340402][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>     [    7.513755][    T1] 0x0000000e0000-0x000000100000 :
> "u-boot-env"
>     [    7.664219][    T1] 0x000000100000-0x000000a00000 : "kernel"
>     [    7.826974][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>     [    8.026666][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>     [    8.201612][    T1] spi-aspeed-smc 1e630000.spi: error -EPERM:
> Error applying setting, reverse things back
>     [    8.370835][    T1] spi-aspeed-smc 1e630000.spi: Calibration area
> too uniform, using low speed
>     [    8.371131][    T1] spi-aspeed-smc 1e630000.spi: Force to dts
> configuration 100000kHz.
>     [    8.371500][    T1] spi-aspeed-smc 1e630000.spi: CE0 read
> buswidth:4 [0x406c0741]
>     [    8.766797][    T1] mdio-aspeed 1e650000.mdio: error -EPERM:
> Error applying setting, reverse things back
>     [    8.906008][    T1] mdio-aspeed 1e650008.mdio: error -EPERM:
> Error applying setting, reverse things back
>     [    9.039240][    T1] mdio-aspeed 1e650010.mdio: error -EPERM:
> Error applying setting, reverse things back
>     [    9.147942][    T1] mdio-aspeed 1e650018.mdio: error -EPERM:
> Error applying setting, reverse things back
> 
> The pinmux configuration fails because the SCU is not unlocked.
> 
> Set both SCU protection keys for the AST2600. Further, set them such that they
> behave accordance with the read value documented by the datasheet. The new
> arrangement now upholds the comment in hw/arm/aspeed.c regarding passing
> -kernel on the qemu command-line.
> 
>     [    7.568170][    T1] Creating 5 MTD partitions on "bmc":
>     [    7.569330][    T1] 0x000000000000-0x0000000e0000 : "u-boot"
>     [    7.740372][    T1] 0x0000000e0000-0x000000100000 :
> "u-boot-env"
>     [    7.883570][    T1] 0x000000100000-0x000000a00000 : "kernel"
>     [    8.041004][    T1] 0x000000a00000-0x000002a00000 : "rofs"
>     [    8.196824][    T1] 0x000002a00000-0x000004000000 : "rwfs"
>     [    8.547037][    T1] spi-aspeed-smc 1e630000.spi: Calibration area
> too uniform, using low speed
>     [    8.547320][    T1] spi-aspeed-smc 1e630000.spi: Force to dts
> configuration 100000kHz.
>     [    8.547642][    T1] spi-aspeed-smc 1e630000.spi: CE0 read
> buswidth:4 [0x406c0741]
>     [    9.494235][    T1] ftgmac100 1e660000.ethernet: Read MAC
> address 52:54:00:12:34:56 from chip
>     [    9.531186][    T1] RTL8211E Gigabit Ethernet 1e650000.mdio-1:00:
> attached PHY driver (mii_bus:phy_addr=1e650000.mdio-1:00,
> 
> Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
> Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
> ---
> I ran into this issue while improving test coverage in my patch review process.
> ---
>  hw/misc/aspeed_scu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c index
> ca93c3699d81..1e3db6d03f91 100644
> --- a/hw/misc/aspeed_scu.c
> +++ b/hw/misc/aspeed_scu.c
> @@ -821,7 +821,8 @@ static void aspeed_ast2600_scu_reset_hold(Object
> *obj, ResetType type)
>      s->regs[AST2600_SILICON_REV2] = s->silicon_rev;
>      s->regs[AST2600_HW_STRAP1] = s->hw_strap1;
>      s->regs[AST2600_HW_STRAP2] = s->hw_strap2;
> -    s->regs[PROT_KEY] = s->hw_prot_key;
> +    s->regs[AST2600_PROT_KEY] = s->hw_prot_key ==
> ASPEED_SCU_PROT_KEY;
> +    s->regs[AST2600_PROT_KEY2] = s->hw_prot_key ==
> ASPEED_SCU_PROT_KEY;
>  }
> 
>  static void aspeed_2600_scu_class_init(ObjectClass *klass, const void *data)
> 
> ---
> base-commit: 9696bf5dc5a5bf0b4a9d05b6cdfe5f13990f97aa
> change-id: 20260818-dev-ast2600-hw-prot-key-reset-e68eb9f49ee9
> 
> Best regards,
> --
> Andrew Jeffery <andrew@codeconstruct.com.au>

Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>

Thanks,
Jamin