qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 1365d8: hw/sd: ssi-sd: Support multiple block


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 1365d8: hw/sd: ssi-sd: Support multiple block read
Date: Sun, 21 Feb 2021 03:45:50 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1365d863a71803a8aac7922986c858ed4dedd826
      
https://github.com/qemu/qemu/commit/1365d863a71803a8aac7922986c858ed4dedd826
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/ssi-sd.c

  Log Message:
  -----------
  hw/sd: ssi-sd: Support multiple block read

In the case of a multiple block read operation every transferred
block has its suffix of CRC16. Update the state machine logic to
handle multiple block read.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
[PMD: Change VMState version id 5 -> 6]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210128063035.15674-2-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: cdf6701bcc71331f8d0744c7f4c3cb309c71d541
      
https://github.com/qemu/qemu/commit/cdf6701bcc71331f8d0744c7f4c3cb309c71d541
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Remove duplicated codes in single/multiple block read/write

The single block read (CMD17) codes are the same as the multiple
block read (CMD18). Merge them into one. The same applies to single
block write (CMD24) and multiple block write (CMD25).

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210128063035.15674-3-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: eedb7f249cabfb03ff778ed2330710fc63a1172a
      
https://github.com/qemu/qemu/commit/eedb7f249cabfb03ff778ed2330710fc63a1172a
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Allow single/multiple block write for SPI mode

At present the single/multiple block write in SPI mode is blocked
by sd_normal_command(). Remove the limitation.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210128063035.15674-4-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 995731d3f754d3110e0abb446ed31790377d211b
      
https://github.com/qemu/qemu/commit/995731d3f754d3110e0abb446ed31790377d211b
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/core.c
    M hw/sd/sd.c
    M include/hw/sd/sd.h

  Log Message:
  -----------
  hw/sd: Introduce receive_ready() callback

At present there is a data_ready() callback for the SD data read
path. Let's add a receive_ready() for the SD data write path.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210128063035.15674-5-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 5020e3cb769e90737bba2d54222a3a449eae7bc0
      
https://github.com/qemu/qemu/commit/5020e3cb769e90737bba2d54222a3a449eae7bc0
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/ssi-sd.c

  Log Message:
  -----------
  hw/sd: ssi-sd: Support single block write

Add 2 more states for the block write operation. The SPI host needs
to send a data start token to start the transfer, and the data block
written to the card will be acknowledged by a data response token.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
[PMD: Change VMState version id 6 -> 7]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210128063035.15674-6-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: d56f3efa28043d17ca0c71752dbde81b25a042cb
      
https://github.com/qemu/qemu/commit/d56f3efa28043d17ca0c71752dbde81b25a042cb
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/ssi-sd.c

  Log Message:
  -----------
  hw/sd: ssi-sd: Support multiple block write

For a multiple block write operation, each block begins with a multi
write start token. Unlike the SD mode that the multiple block write
ends when receiving a STOP_TRAN command (CMD12), a special stop tran
token is used to signal the card.

Emulating this by manually sending a CMD12 to the SD card core, to
bring it out of the receiving data state.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210128063035.15674-7-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 6ae29af3ed4b24dc733ed4186ebe906b6d1063cd
      
https://github.com/qemu/qemu/commit/6ae29af3ed4b24dc733ed4186ebe906b6d1063cd
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/ssi-sd.c

  Log Message:
  -----------
  hw/sd: ssi-sd: Fix SEND_IF_COND (CMD8) response

The SEND_IF_COND command (CMD8) response is of format R7, but
current code returns R1 for CMD8. Fix it.

Fixes: 775616c3ae8c ("Partial SD card SPI mode support")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210128063035.15674-8-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 5b45a3666ef77ec65f49b0b074a28f1ef460b9c5
      
https://github.com/qemu/qemu/commit/5b45a3666ef77ec65f49b0b074a28f1ef460b9c5
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/ssi-sd.c

  Log Message:
  -----------
  hw/sd: ssi-sd: Fix STOP_TRANSMISSION (CMD12) response

CMD12's response type is R1b, which is basically a R1 plus optional
addition of the busy signal token that can be any number of bytes.
A zero value indicates card is busy and a non-zero value indicates
the card is ready for the next command.

Current implementation sends the busy signal token without sending
the R1 first. This does not break the U-Boot/Linux mmc_spi driver,
but it does not make the VxWorks driver happy.

Move the testing logic of s->stopping in the SSI_SD_RESPONSE state
a bit later, after the first byte of the card reponse is sent out,
to conform with the spec. After the busy signal token is sent, the
state should be transferred to SSI_SD_CMD.

Fixes: 775616c3ae8c ("Partial SD card SPI mode support")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20210128063035.15674-9-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 17674695aba3d3fdeec4aeed7920fb760956c807
      
https://github.com/qemu/qemu/commit/17674695aba3d3fdeec4aeed7920fb760956c807
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/ssi-sd.c

  Log Message:
  -----------
  hw/sd: ssi-sd: Handle the rest commands with R1b response type

Besides CMD12, the following command's reponse type is R1b:

- SET_WRITE_PROT (CMD28)
- CLR_WRITE_PROT (CMD29)
- ERASE (CMD38)

Reuse the same s->stopping to indicate a R1b reponse is needed.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210128063035.15674-10-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 64ea2d9f74a824269f2f564632bda52d60ae9243
      
https://github.com/qemu/qemu/commit/64ea2d9f74a824269f2f564632bda52d60ae9243
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Fix address check in sd_erase()

For high capacity memory cards, the erase start address and end
address are multiplied by 512, but the address check is still
based on the original block number in sd->erase_{start, end}.

Fixes: 1bd6fd8ed593 ("hw/sd/sdcard: Do not attempt to erase out of range 
addresses")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-2-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 245c05134fcf642491eec04e4449f70e043e1b2e
      
https://github.com/qemu/qemu/commit/245c05134fcf642491eec04e4449f70e043e1b2e
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Only SDSC cards support CMD28/29/30

Per the "Physical Layer Specification Version 8.00", table 4-26
(SD mode) and table 7-3 (SPI mode) command descriptions, the
following commands:

- CMD28 (SET_WRITE_PROT)
- CMD29 (CLR_WRITE_PROT)
- CMD30 (SEND_WRITE_PROT)

are only supported by SDSC cards.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-3-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 69694973a8ae7381128c17e72ebf55fd592640f5
      
https://github.com/qemu/qemu/commit/69694973a8ae7381128c17e72ebf55fd592640f5
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Fix CMD30 response type

Per the "Physical Layer Specification Version 8.00", table 4-26
(SD mode) and table 7-3 (SPI mode) command descriptions, CMD30
response type is R1, not R1b.

Fixes: a1bb27b1e98a ("SD card emulation initial implementation")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-4-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: ce6ea2efc5fb308ebf11339276f60215fe0ec44c
      
https://github.com/qemu/qemu/commit/ce6ea2efc5fb308ebf11339276f60215fe0ec44c
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Move the sd_block_{read, write} and macros ahead

These APIs and macros may be referenced by functions that are
currently before them. Move them ahead a little bit.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-5-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 2473dc4022458dcc05ec367ce97edbef29d7e50c
      
https://github.com/qemu/qemu/commit/2473dc4022458dcc05ec367ce97edbef29d7e50c
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Skip write protect groups check in sd_erase() for high capacity 
cards

High capacity cards don't support write protection hence we should
not perform the write protect groups check in sd_erase() for them.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-6-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 19fa6c9e9bc2061be39b0337a9eee859563e272a
      
https://github.com/qemu/qemu/commit/19fa6c9e9bc2061be39b0337a9eee859563e272a
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Skip write protect groups check in CMD24/25 for high capacity cards

High capacity cards don't support write protection hence we should
not perform the write protect groups check in CMD24/25 for them.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-8-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: c557e08d9c9729cdf6b98f7a9c1ebf72fa25e916
      
https://github.com/qemu/qemu/commit/c557e08d9c9729cdf6b98f7a9c1ebf72fa25e916
  Author: Bin Meng <bin.meng@windriver.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sd.c

  Log Message:
  -----------
  hw/sd: sd: Bypass the RCA check for CMD13 in SPI mode

Unlike SD mode, when SD card is working in SPI mode, the argument
of CMD13 is stuff bits. Hence we should bypass the RCA check.

See "Physical Layer Specification Version 8.00", chapter 7.3.1.3
Detailed Command Description (SPI mode):

  "The card shall ignore stuff bits and reserved bits in an argument"

and Table 7-3 Commands and Arguments (SPI mode):

  "CMD13 Argument [31:0] stuff bits"

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210216150225.27996-9-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 8bc1f1aa51d32c3184e7b19d5b94c35ecc06f056
      
https://github.com/qemu/qemu/commit/8bc1f1aa51d32c3184e7b19d5b94c35ecc06f056
  Author: Bin Meng <bmeng.cn@gmail.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M hw/sd/sdhci.c

  Log Message:
  -----------
  hw/sd: sdhci: Simplify updating s->prnsts in 
sdhci_sdma_transfer_multi_blocks()

s->prnsts is updated in both branches of the if () else () statement.
Move the common bits outside so that it is cleaner.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1613447214-81951-5-git-send-email-bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  Commit: 3e0a7693be30d6a6eda8a56f3862ac2e502a9e81
      
https://github.com/qemu/qemu/commit/3e0a7693be30d6a6eda8a56f3862ac2e502a9e81
  Author: Philippe Mathieu-Daudé <f4bug@amsat.org>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M MAINTAINERS

  Log Message:
  -----------
  MAINTAINERS: Add Bin Meng as co-maintainer for SD/MMC cards

There is new interest in the SD/MMC device emulation, so it
would be good to have more than only one maintainer / reviewer
for it.

Bin Meng proved by his contributions a deep understanding of the
SD cards internals, so let's add him to the corresponding section
in the MAINTAINERS file.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20210216132841.1121653-1-f4bug@amsat.org>


  Commit: a528b8c4c638d60cc474c2f80952ff0f2e60521a
      
https://github.com/qemu/qemu/commit/a528b8c4c638d60cc474c2f80952ff0f2e60521a
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M MAINTAINERS
    M hw/sd/core.c
    M hw/sd/sd.c
    M hw/sd/sdhci.c
    M hw/sd/ssi-sd.c
    M include/hw/sd/sd.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/philmd-gitlab/tags/sdmmc-20210220' into 
staging

SD/MMC patches

- Various improvements for SD cards in SPI mode (Bin Meng)
- Add Bin Meng as SD/MMC cards co-maintainer

# gpg: Signature made Sat 20 Feb 2021 00:09:44 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" 
[full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd-gitlab/tags/sdmmc-20210220:
  MAINTAINERS: Add Bin Meng as co-maintainer for SD/MMC cards
  hw/sd: sdhci: Simplify updating s->prnsts in 
sdhci_sdma_transfer_multi_blocks()
  hw/sd: sd: Bypass the RCA check for CMD13 in SPI mode
  hw/sd: sd: Skip write protect groups check in CMD24/25 for high capacity cards
  hw/sd: sd: Skip write protect groups check in sd_erase() for high capacity 
cards
  hw/sd: sd: Move the sd_block_{read, write} and macros ahead
  hw/sd: sd: Fix CMD30 response type
  hw/sd: sd: Only SDSC cards support CMD28/29/30
  hw/sd: sd: Fix address check in sd_erase()
  hw/sd: ssi-sd: Handle the rest commands with R1b response type
  hw/sd: ssi-sd: Fix STOP_TRANSMISSION (CMD12) response
  hw/sd: ssi-sd: Fix SEND_IF_COND (CMD8) response
  hw/sd: ssi-sd: Support multiple block write
  hw/sd: ssi-sd: Support single block write
  hw/sd: Introduce receive_ready() callback
  hw/sd: sd: Allow single/multiple block write for SPI mode
  hw/sd: sd: Remove duplicated codes in single/multiple block read/write
  hw/sd: ssi-sd: Support multiple block read

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/d6798cc01d6e...a528b8c4c638



reply via email to

[Prev in Thread] Current Thread [Next in Thread]