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

Jamin Lin <[email protected]>
Newsgroups org.nongnu.qemu-devel,org.nongnu.qemu-arm
Message-ID <TYZPR06MB49807501A1E666F8F5FD1BC8FCA62@TYZPR06MB4980.apcprd06.prod.outlook.com>
> 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 <[email protected]>
> ---
> 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 <[email protected]>

Reviewed-by: Jamin Lin <[email protected]>

Thanks,
Jamin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.