Re: [PATCH 1/3] ram: ast2600: Fix incorrect statement of the register polling
On Fri, Nov 11, 2022 at 03:30:06PM +0800, Dylan Hung wrote: > The condition "~data" in the if-statement is a typo. The original > intention is to poll if SDRAM_PHYCTRL0_INIT bit equals to 0. So use > "data == 0" for instead. > > Besides, the bit[1] of "phy_status" register is hardwired to > SDRAM_PHYCTRL0_INIT (with inverse logic). Since SDRAM_PHYCTRL0_INIT has > already done, remove the unnecessary checking of phy_status[1]. > > Fixes: fde93143469f ("ram: aspeed: Add AST2600 DRAM control support") > > Signed-off-by: Dylan Hung Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
RE: [PATCH 1/3] ram: ast2600: Fix incorrect statement of the register polling
> -Original Message- > From: Dylan Hung > Sent: Friday, November 11, 2022 3:30 PM > To: Ryan Chen ; ChiaWei Wang > ; j...@jms.id.au; Dylan Hung > ; u-boot@lists.denx.de > Cc: BMC-SW > Subject: [PATCH 1/3] ram: ast2600: Fix incorrect statement of the register > polling > > The condition "~data" in the if-statement is a typo. The original intention > is > to poll if SDRAM_PHYCTRL0_INIT bit equals to 0. So use "data == 0" for > instead. > > Besides, the bit[1] of "phy_status" register is hardwired to > SDRAM_PHYCTRL0_INIT (with inverse logic). Since SDRAM_PHYCTRL0_INIT has > already done, remove the unnecessary checking of phy_status[1]. > > Fixes: fde93143469f ("ram: aspeed: Add AST2600 DRAM control support") > > Signed-off-by: Dylan Hung Review-by: Ryan Chen > --- > drivers/ram/aspeed/sdram_ast2600.c | 7 +-- > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/ram/aspeed/sdram_ast2600.c > b/drivers/ram/aspeed/sdram_ast2600.c > index 9ad398d24155..b09232a30413 100644 > --- a/drivers/ram/aspeed/sdram_ast2600.c > +++ b/drivers/ram/aspeed/sdram_ast2600.c > @@ -449,7 +449,7 @@ static void ast2600_sdramphy_kick_training(struct > dram_info *info) > > while (1) { > data = readl(>phy_ctrl[0]) & SDRAM_PHYCTRL0_INIT; > - if (~data) > + if (data == 0) > break; > } > } > @@ -984,11 +984,6 @@ static int ast2600_sdrammc_probe(struct udevice > *dev) > L_ast2600_sdramphy_train: > ast2600_sdrammc_init_ddr4(priv); > > - /* make sure DDR-PHY is ready before access */ > - do { > - reg = readl(priv->phy_status) & BIT(1); > - } while (reg == 0); > - > if (ast2600_sdramphy_check_status(priv) != 0) { > printf("DDR4 PHY training fail, retrain\n"); > goto L_ast2600_sdramphy_train; > -- > 2.25.1
[PATCH 1/3] ram: ast2600: Fix incorrect statement of the register polling
The condition "~data" in the if-statement is a typo. The original intention is to poll if SDRAM_PHYCTRL0_INIT bit equals to 0. So use "data == 0" for instead. Besides, the bit[1] of "phy_status" register is hardwired to SDRAM_PHYCTRL0_INIT (with inverse logic). Since SDRAM_PHYCTRL0_INIT has already done, remove the unnecessary checking of phy_status[1]. Fixes: fde93143469f ("ram: aspeed: Add AST2600 DRAM control support") Signed-off-by: Dylan Hung --- drivers/ram/aspeed/sdram_ast2600.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/ram/aspeed/sdram_ast2600.c b/drivers/ram/aspeed/sdram_ast2600.c index 9ad398d24155..b09232a30413 100644 --- a/drivers/ram/aspeed/sdram_ast2600.c +++ b/drivers/ram/aspeed/sdram_ast2600.c @@ -449,7 +449,7 @@ static void ast2600_sdramphy_kick_training(struct dram_info *info) while (1) { data = readl(>phy_ctrl[0]) & SDRAM_PHYCTRL0_INIT; - if (~data) + if (data == 0) break; } } @@ -984,11 +984,6 @@ static int ast2600_sdrammc_probe(struct udevice *dev) L_ast2600_sdramphy_train: ast2600_sdrammc_init_ddr4(priv); - /* make sure DDR-PHY is ready before access */ - do { - reg = readl(priv->phy_status) & BIT(1); - } while (reg == 0); - if (ast2600_sdramphy_check_status(priv) != 0) { printf("DDR4 PHY training fail, retrain\n"); goto L_ast2600_sdramphy_train; -- 2.25.1