qemu: aspeed_smc: Calculate checksum on normal DMA
PATCH 1/1 qemu: aspeed_smc: Calculate checksum on normal DMA
This patch adds the missing checksum calculation on normal DMA transfer. According to the datasheet this is how the SMC should behave.
Verified on AST1250 that the hardware matches the behaviour.
--- hw/ssi/aspeed_smc.c | 1 + 1 file changed, 1 insertion(+)
hw/ssi/aspeed_smc.c +1 -0
@@ -871,6 +871,7 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s) s->regs[R_DMA_FLASH_ADDR ] +=4 ; s->regs[R_DMA_DRAM_ADDR ] +=4 ; s->regs[R_DMA_LEN ] -=4 ; + s->regs[R_DMA_CHECKSUM ] += data; } }
Signature · 1 line
2.19.1.930.g4563a0d9d0-goog
Hello Christian,
Quoted 2 lines · Christian Svensson
This patch adds the missing checksum calculation on normal DMA transfer. According to the datasheet this is how the SMC should behave.
The datasheet is not very clear on the topic.
Bit 2 of FMC80 says :
CheckSum Calculation Only
0: Normal DMA operation
1: Checksum accumulation only
This bit is valid only when the DMA direction = 0
and one could understand that under Normal DMA operation, there is no Checksum accumulation.
Anyhow, I am ok for adding the change.
Quoted 1 line
Verified on AST1250 that the hardware matches the behaviour.
Did you check under u-boot, did you add DMA support to the Linux driver ? do you have a firmware doing so you could share ? I would like to check for the ast2500.
Thanks,
C.
Quoted 18 lines
Signed-off-by Christian Svensson <[email protected]>--- hw/ssi/aspeed_smc.c | 1 + 1 file changed, 1 insertion(+)hw/ssi/aspeed_smc.c +1
-0@@ -871,6 +871,7 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s) s->regs[R_DMA_FLASH_ADDR ] +=4 ; s->regs[R_DMA_DRAM_ADDR ] +=4 ; s->regs[R_DMA_LEN ] -=4 ; + s->regs[R_DMA_CHECKSUM ] += data; } }
Hi,
Thanks for the review.
Quoted 1 line · Cédric Le Goater
The datasheet is not very clear on the topic.
I won't argue there.
Quoted 2 lines
and one could understand that under Normal DMA operation, there is no Checksum accumulation.
Indeed, that's what I thought as well. Then my question to myself was that since that means that you can either 1) transfer data or 2) calculate the checksum it seems like a pretty useless feature.
If you look at 8.6.2 DMA CheckSum Calculation Mode (for ast2400 at least) you
see the sentence:
Quoted 1 line
5. FMC80[2] is set when only checksum calculation is necessary, no data
movement
Which I take to read that you can execute the whole section and you will get a checksum + data transfer, but if you set FMC80[2] then you get the checksum, but no data movement.
Quoted 2 lines
do you have a firmware doing so you could share ? I would like to check for the ast2500.
I have my own firmware here:
https://github.com/u-root/u-bmc/blob/07979a696df4351ec6dbb424ca80a5ebcc2eda1d/platform/ast2400/boot/main.S
Cheers,
Ping. What's left to be done here?
Quoted 35 lines · Christian Svensson
Hi,
Thanks for the review.
Quoted 1 line · Cédric Le Goater
The datasheet is not very clear on the topic.
I won't argue there.
Quoted 2 lines
and one could understand that under Normal DMA operation, there is no Checksum accumulation.
Indeed, that's what I thought as well. Then my question to myself was that since that means that you can either 1) transfer data or 2) calculate the checksum it seems like a pretty useless feature.
If you look at 8.6.2 DMA CheckSum Calculation Mode (for ast2400 at least) you
see the sentence:Quoted 1 line
5. FMC80[2] is set when only checksum calculation is necessary, no data
movement
Which I take to read that you can execute the whole section and you will get a checksum + data transfer, but if you set FMC80[2] then you get the checksum, but no data movement.
Quoted 2 lines
do you have a firmware doing so you could share ? I would like to check for the ast2500.
I have my own firmware here:
Cheers,
Quoted 1 line · Christian Svensson
Ping. What's left to be done here?
Nothing. I have merged the update in my patch.
Thanks,
C.
Quoted 34 lines · On Mon, Nov 12, 2018 at 3:52 PM Christian Svensson <[email protected]…
Hi,
Thanks for the review.
On Mon, Nov 12, 2018 at 3:39 PM Cédric Le Goater <[email protected] <mailto:[email protected]>> wrote:
> The datasheet is not very clear on the topic.I won't argue there.
> and one could understand that under Normal DMA operation, there is > no Checksum accumulation.
Indeed, that's what I thought as well. Then my question to myself was that since that means that you can either 1) transfer data or 2) calculate the checksum it seems like a pretty useless feature.
If you look at 8.6.2 DMA CheckSum Calculation Mode (for ast2400 at least) you see the sentence:
> 5. FMC80[2] is set when only checksum calculation is necessary, no data movementWhich I take to read that you can execute the whole section and you will get a checksum + data transfer, but if you set FMC80[2] then you get the checksum, but no data movement.
> do you have a firmware doing so you could share ? I would like to check > for the ast2500.
I have my own firmware here:
https://github.com/u-root/u-bmc/blob/07979a696df4351ec6dbb424ca80a5ebcc2eda1d/platform/ast2400/boot/main.SCheers,