aspeed queue
Subsystems (4)
The following changes since commit 17780edd81d27fcfdb7a802efc870a99788bd2fc:
Merge tag 'quick-fix-pull-request' of https://gitlab.com/bsdimp/qemu into staging (2023-08-31 10:06:29 -0400)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20230901
for you to fetch changes up to c3287c0f70dae07dd12322c5c8663f7b878826e7:
hw/sd: Introduce a "sd-card" SPI variant model (2023-09-01 11:40:04 +0200)
----------------------------------------------------------------
aspeed queue:
* Fixes for the Aspeed I2C model
* New SDK image for avocado tests
* blockdev support for flash device definition
* SD refactoring preparing ground for eMMC support
----------------------------------------------------------------
Cédric Le Goater (10):
aspeed: Introduce helper for 32-bit hosts limitation tests/avocado/machine_aspeed.py: Update SDK images hw/ssi: Add a "cs" property to SSIPeripheral
hw/ssi: Introduce a ssi_get_cs() helper
aspeed/smc: Wire CS lines at reset
hw/ssi: Check for duplicate CS indexes
aspeed: Create flash devices only when defaults are enabled
m25p80: Introduce an helper to retrieve the BlockBackend of a device
aspeed: Get the BlockBackend of FMC0 from the flash device hw/sd: Introduce a "sd-card" SPI variant model
Hang Yu (3):
hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode hw/i2c/aspeed: Fix TXBUF transmission start position error hw/i2c/aspeed: Add support for buffer organization
Joel Stanley (1):
hw/sd: Add sd_cmd_SEND_TUNING_BLOCK() handler
Philippe Mathieu-Daudé (12):
hw/sd/sdcard: Return ILLEGAL for CMD19/CMD23 prior SD spec v3.01 hw/sd: When card is in wrong state, log which state it is hw/sd: When card is in wrong state, log which spec version is used hw/sd: Move proto_name to SDProto structure
hw/sd: Introduce sd_cmd_handler type
hw/sd: Add sd_cmd_illegal() handler
hw/sd: Add sd_cmd_unimplemented() handler
hw/sd: Add sd_cmd_GO_IDLE_STATE() handler
hw/sd: Add sd_cmd_SEND_OP_CMD() handler
hw/sd: Add sd_cmd_ALL_SEND_CID() handler
hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler
hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler
docs/system/arm/aspeed.rst | 35 +++- include/hw/block/flash.h | 4 + include/hw/i2c/aspeed_i2c.h | 5 +- include/hw/sd/sd.h | 5 + include/hw/ssi/ssi.h | 5 + hw/arm/aspeed.c | 40 ++--- hw/arm/stellaris.c | 7 +- hw/arm/xilinx_zynq.c | 1 + hw/arm/xlnx-versal-virt.c | 1 + hw/arm/xlnx-zcu102.c | 2 + hw/block/m25p80.c | 6 + hw/i2c/aspeed_i2c.c | 40 ++--- hw/microblaze/petalogix_ml605_mmu.c | 1 + hw/riscv/sifive_u.c | 3 +- hw/sd/sd.c | 348 ++++++++++++++++++++++-------------- hw/sd/sdmmc-internal.c | 2 +- hw/ssi/aspeed_smc.c | 8 + hw/ssi/ssi.c | 43 +++++ tests/avocado/machine_aspeed.py | 12 +- 19 files changed, 367 insertions(+), 201 deletions(-)
[PULL 01/26] aspeed: Introduce helper for 32-bit hosts limitation
On 32-bit hosts, RAM has a 2047 MB limit. Use a macro to define the default ram size of machines (AST2600 SoC) that can have 2 GB.
--- hw/arm/aspeed.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
hw/arm/aspeed.c +9 -12
@@ -47,6 +47,13 @@ struct AspeedMachineState {char *spi_model; }; +/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */ +#if HOST_LONG_BITS ==32 +#define ASPEED_RAM_SIZE (sz) MIN((sz), 1 * GiB) +#else +#define ASPEED_RAM_SIZE (sz) (sz) +#endif +/* Palmetto hardware value: 0x120CE416 */ #define PALMETTO_BMC_HW_STRAP1 ( \ SCU_AST2400_HW_STRAP_DRAM_SIZE(DRAM_SIZE_256MB) | \
@@ -1423,12 +1430,7 @@ static void aspeed_machine_rainier_class_init(ObjectClass *oc, void *data)aspeed_soc_num_cpus (amc->soc_name); }; -/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */ -#if HOST_LONG_BITS ==32 -#define FUJI_BMC_RAM_SIZE (1 * GiB) -#else -#define FUJI_BMC_RAM_SIZE (2 * GiB) -#endif +#define FUJI_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)static void aspeed_machine_fuji_class_init (ObjectClass *oc,void *data) {
@@ -1450,12 +1452,7 @@ static void aspeed_machine_fuji_class_init(ObjectClass *oc, void *data)aspeed_soc_num_cpus (amc->soc_name); }; -/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */ -#if HOST_LONG_BITS ==32 -#define BLETCHLEY_BMC_RAM_SIZE (1 * GiB) -#else -#define BLETCHLEY_BMC_RAM_SIZE (2 * GiB) -#endif +#define BLETCHLEY_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)static void aspeed_machine_bletchley_class_init (ObjectClass *oc,void *data) {
Signature · 1 line
2.41.0
[PULL 07/26] hw/ssi: Introduce a ssi_get_cs() helper
In reply to Cédric Le GoaterSimple routine to retrieve a DeviceState object on a SPI bus using its CS index. It will be useful for the board to wire the CS lines.
--- include/hw/ssi/ssi.h | 2 ++ hw/ssi/ssi.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+)
include/hw/ssi/ssi.h +2 -0
@@ -112,4 +112,6 @@ SSIBus *ssi_create_bus(DeviceState *parent, const char *name);uint32_t ssi_transfer (SSIBus *bus,uint32_t val); +DeviceState *ssi_get_cs (SSIBus *bus,uint8_t cs_index); +#endif
hw/ssi/ssi.c +15 -0
@@ -27,6 +27,21 @@ struct SSIBus {#define TYPE_SSI_BUS "SSI" OBJECT_DECLARE_SIMPLE_TYPE(SSIBus, SSI_BUS) +DeviceState *ssi_get_cs (SSIBus *bus,uint8_t cs_index) +{ +BusState *b =BUS (bus); +BusChild *kid; + + QTAILQ_FOREACH(kid, &b->children, sibling) { +SSIPeripheral *kid_ssi =SSI_PERIPHERAL (kid->child); +if (kid_ssi->cs_index == cs_index) { +return kid->child; + } + } + +return NULL ; +} +static const TypeInfo ssi_bus_info = { .name =TYPE_SSI_BUS , .parent =TYPE_BUS ,
Signature · 1 line
2.41.0
[PULL 11/26] m25p80: Introduce an helper to retrieve the BlockBackend of a device
In reply to Cédric Le GoaterIt will help in getting rid of some drive_get(IF_MTD) calls by retrieving the BlockBackend directly from the m25p80 device.
--- include/hw/block/flash.h | 4 ++++ hw/block/m25p80.c | 6 ++++++ 2 files changed, 10 insertions(+)
include/hw/block/flash.h +4 -0
@@ -76,4 +76,8 @@ uint8_t ecc_digest(ECCState *s, uint8_t sample);void ecc_reset (ECCState *s);extern const VMStateDescription vmstate_ecc_state; +/* m25p80.c */ + +BlockBackend *m25p80_get_blk (DeviceState *dev); +#endif
hw/block/m25p80.c +6 -0
@@ -25,6 +25,7 @@#include "qemu/units.h" #include "sysemu/block-backend.h" #include "hw/block/block.h" +#include "hw/block/flash.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h"
@@ -1830,3 +1831,8 @@ static void m25p80_register_types(void) }type_init (m25p80_register_types) + +BlockBackend *m25p80_get_blk(DeviceState *dev) +{ +return M25P80 (dev)->blk; +}
Signature · 1 line
2.41.0
[PULL 12/26] aspeed: Get the BlockBackend of FMC0 from the flash device
In reply to Cédric Le Goaterand get rid of an unnecessary drive_get(IF_MTD) call.
--- hw/arm/aspeed.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/arm/aspeed.c +5 -3
@@ -15,6 +15,7 @@#include "hw/arm/aspeed.h" #include "hw/arm/aspeed_soc.h" #include "hw/arm/aspeed_eeprom.h" +#include "hw/block/flash.h" #include "hw/i2c/i2c_mux_pca954x.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/misc/pca9552.h"
@@ -436,11 +437,12 @@ static void aspeed_machine_init(MachineState *machine) }if (!bmc->mmio_exec) { -DriveInfo *mtd0 =drive_get (IF_MTD ,0 ,0 ); +DeviceState *dev =ssi_get_cs (bmc->soc.fmc.spi,0 ); +BlockBackend *fmc0 = dev ?m25p80_get_blk (dev) :NULL ; -if (mtd0) { +if (fmc0) {uint64_t rom_size =memory_region_size (&bmc->soc.spi_boot); -aspeed_install_boot_rom (bmc,blk_by_legacy_dinfo (mtd0), rom_size); +aspeed_install_boot_rom (bmc, fmc0, rom_size); } }
Signature · 1 line
2.41.0
[PULL 10/26] aspeed: Create flash devices only when defaults are enabled
In reply to Cédric Le GoaterWhen the -nodefaults option is set, flash devices should be created with :
-blockdev node-name=fmc0,driver=file,filename=./flash.img \
-device mx66u51235f,cs=0x0,bus=ssi.0,drive=fmc0 \To be noted that in this case, the ROM will not be installed and the initial boot sequence (U-Boot loading) will fetch instructions using SPI transactions which is significantly slower. That's exactly how HW operates though.
--- docs/system/arm/aspeed.rst | 35 +++++++++++++++++++++++++++++------ hw/arm/aspeed.c | 6 ++++-- 2 files changed, 33 insertions(+), 8 deletions(-)
docs/system/arm/aspeed.rst +29 -6
@@ -104,7 +104,7 @@ To boot a kernel directly from a Linux build tree: -dtb arch/arm/boot/dts/aspeed-ast2600-evb.dtb \ -initrd rootfs.cpio -The image should be attached as an MTD drive. Run : +To boot the machine from the flash image, use an MTD drive : .. code-block:: bash
@@ -117,23 +117,46 @@ Options specific to Aspeed machines are : device by using the FMC controller to load the instructions, and not simply from RAM. This takes a little longer. - * ``fmc-model`` to change the FMC Flash model. FW needs support for - the chip model to boot. + * ``fmc-model`` to change the default FMC Flash model. FW needs + support for the chip model to boot. - * ``spi-model`` to change the SPI Flash model. + * ``spi-model`` to change the default SPI Flash model. * ``bmc-console`` to change the default console device. Most of the machines use the ``UART5`` device for a boot console, which is mapped on ``/dev/ttyS4`` under Linux, but it is not always the case. -For instance, to start the ``ast2500-evb`` machine with a different -FMC chip and a bigger (64M) SPI chip, use : +To use other flash models, for instance a different FMC chip and a +bigger (64M) SPI for the ``ast2500-evb`` machine, run : .. code-block:: bash -M ast2500-evb,fmc-model=mx25l25635e,spi-model=mx66u51235f +When more flexibility is needed to define the flash devices, to use +different flash models or define all flash devices (up to 8), the +``-nodefaults`` QEMU option can be used to avoid creating the default +flash devices. + +Flash devices should then be created from the command line and attached +to a block device : + +.. code-block:: bash + + $ qemu-system-arm -M ast2600-evb \ + -blockdev node-name=fmc0,driver=file,filename=/path/to/fmc0.img \ + -device mx66u51235f,bus=ssi.0,cs=0x0,drive=fmc0 \ + -blockdev node-name=fmc1,driver=file,filename=/path/to/fmc1.img \ + -device mx66u51235f,bus=ssi.0,cs=0x1,drive=fmc1 \ + -blockdev node-name=spi1,driver=file,filename=/path/to/spi1.img \ + -device mx66u51235f,cs=0x0,bus=ssi.1,drive=spi1 \ + -nographic -nodefaults + +In that case, the machine boots fetching instructions from the FMC0 +device. It is slower to start but closer to what HW does. Using the +machine option ``execute-in-place`` has a similar effect. + To change the boot console and use device ``UART3`` (``/dev/ttyS2`` under Linux), use :
hw/arm/aspeed.c +4 -2
@@ -396,12 +396,14 @@ static void aspeed_machine_init(MachineState *machine)connect_serial_hds_to_uarts (bmc);qdev_realize (DEVICE (&bmc->soc),NULL , &error_abort); -aspeed_board_init_flashes (&bmc->soc.fmc, +if (defaults_enabled ()) { +aspeed_board_init_flashes (&bmc->soc.fmc, bmc->fmc_model ? bmc->fmc_model : amc->fmc_model, amc->num_cs,0 ); -aspeed_board_init_flashes (&bmc->soc.spi[0 ], +aspeed_board_init_flashes (&bmc->soc.spi[0 ], bmc->spi_model ? bmc->spi_model : amc->spi_model,1 , amc->num_cs); + }if (machine->kernel_filename && sc->num_cpus >1 ) {/* With no u-boot we must set up a boot stub for the secondary CPU */
Signature · 1 line
2.41.0
[PULL 23/26] hw/sd: Add sd_cmd_SEND_RELATIVE_ADDR() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
--- hw/sd/sd.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
hw/sd/sd.c +15 -13
@@ -1048,6 +1048,20 @@ static sd_rsp_type_t sd_cmd_ALL_SEND_CID(SDState *sd, SDRequest req)return sd_r2_i; } +static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR (SDState *sd,SDRequest req) +{ +switch (sd->state) { +case sd_identification_state: +case sd_standby_state: + sd->state = sd_standby_state; +sd_set_rca (sd); +return sd_r6; + +default : +return sd_invalid_state_for_cmd (sd, req); + } +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1087,19 +1101,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)switch (req.cmd) {/* Basic commands (Class 0 and Class 1) */ -case 3 :/* CMD3: SEND_RELATIVE_ADDR */ -switch (sd->state) { -case sd_identification_state: -case sd_standby_state: - sd->state = sd_standby_state; -sd_set_rca (sd); -return sd_r6; - -default : -break ; - } -break ; -case 4 :/* CMD4: SEND_DSR */ switch (sd->state) {case sd_standby_state:
@@ -2149,6 +2150,7 @@ static const SDProto sd_proto_sd = { [0] = sd_cmd_GO_IDLE_STATE, [1] = sd_cmd_illegal, [2] = sd_cmd_ALL_SEND_CID, + [3] = sd_cmd_SEND_RELATIVE_ADDR, [5] = sd_cmd_illegal, [52 ... 54] = sd_cmd_illegal, [58] = sd_cmd_illegal,
Signature · 1 line
2.41.0
[PULL 02/26] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
In reply to Cédric Le GoaterFrom: Hang Yu <[email protected]>
Fixed inconsistency between the regisiter bit field definition header file and the ast2600 datasheet. The reg name is I2CD1C:Pool Buffer Control Register in old register mode and I2CC0C: Master/Slave Pool Buffer Control Register in new register mode. They share bit field [12:8]:Transmit Data Byte Count and bit field
[29:24]:Actual Received Pool Buffer Size according to the datasheet. According to the ast2600 datasheet,the actual Tx count is Transmit Data Byte Count plus 1, and the max Rx size is
Receive Pool Buffer Size plus 1, both in Pool Buffer Control Register. The version before forgot to plus 1, and mistake Rx count for Rx size.
--- include/hw/i2c/aspeed_i2c.h | 4 ++-- hw/i2c/aspeed_i2c.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/i2c/aspeed_i2c.h +2 -2
@@ -139,9 +139,9 @@ REG32(I2CD_CMD, 0x14) /* I2CD Command/Status */ REG32(I2CD_DEV_ADDR, 0x18) /* Slave Device Address */ SHARED_FIELD(SLAVE_DEV_ADDR1, 0, 7) REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */ - SHARED_FIELD(RX_COUNT, 24, 5) + SHARED_FIELD(RX_COUNT, 24, 6) SHARED_FIELD(RX_SIZE, 16, 5) - SHARED_FIELD(TX_COUNT, 9, 5) + SHARED_FIELD(TX_COUNT, 8, 5) FIELD(I2CD_POOL_CTRL, OFFSET, 2, 6) /* AST2400 */ REG32(I2CD_BYTE_BUF, 0x20) /* Transmit/Receive Byte Buffer */SHARED_FIELD (RX_BUF ,8 ,8 )
hw/i2c/aspeed_i2c.c +4 -4
@@ -236,7 +236,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)uint32_t reg_byte_buf =aspeed_i2c_bus_byte_buf_offset (bus);uint32_t reg_dma_len =aspeed_i2c_bus_dma_len_offset (bus);int pool_tx_count =SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl, -TX_COUNT ); +TX_COUNT ) +1 ;if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_BUFF_EN )) {for (i = pool_start; i < pool_tx_count; i++) {
@@ -293,7 +293,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)uint32_t reg_dma_len =aspeed_i2c_bus_dma_len_offset (bus);uint32_t reg_dma_addr =aspeed_i2c_bus_dma_addr_offset (bus);int pool_rx_count =SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl, -RX_COUNT ); +RX_SIZE ) +1 ;if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,RX_BUFF_EN )) {uint8_t *pool_base = aic->bus_pool_base (bus);
@@ -418,7 +418,7 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)uint32_t reg_intr_sts =aspeed_i2c_bus_intr_sts_offset (bus);uint32_t reg_dma_len =aspeed_i2c_bus_dma_len_offset (bus);if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,RX_BUFF_EN )) { - count =SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl,TX_COUNT ); + count =SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl,TX_COUNT ) +1 ; }else if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,RX_DMA_EN )) { count = bus->regs[reg_dma_len]; }else {/* BYTE mode */
@@ -490,7 +490,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)*/ if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_BUFF_EN )) {if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl,TX_COUNT ) - ==1 ) { + ==0 ) {SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_cmd,M_TX_CMD ,0 ); }else {/*
Signature · 1 line
2.41.0
[PULL 17/26] hw/sd: Introduce sd_cmd_handler type
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Add 2 command handler arrays in SDProto, for CMD and ACMD. Have sd_normal_command() / sd_app_command() use these arrays:
if an command handler is registered, call it, otherwise fall back to current code base.
Message-Id: <[email protected]>
--- hw/sd/sd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/sd/sd.c +13 -0
@@ -87,8 +87,12 @@ enum SDCardStates { sd_disconnect_state, }; +typedef sd_rsp_type_t (*sd_cmd_handler )(SDState *sd,SDRequest req); +typedef struct SDProto {const char *name; +sd_cmd_handler cmd[SDMMC_CMD_MAX ]; +sd_cmd_handler acmd[SDMMC_CMD_MAX ]; }SDProto ;struct SDState {
@@ -1031,6 +1035,10 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)return sd_illegal; } +if (sd_proto (sd)->cmd[req.cmd]) { +return sd_proto (sd)->cmd[req.cmd](sd, req); + } +switch (req.cmd) {/* Basic commands (Class 0 and Class 1) */ case 0 :/* CMD0: GO_IDLE_STATE */
@@ -1575,6 +1583,11 @@ static sd_rsp_type_t sd_app_command(SDState *sd,trace_sdcard_app_command (sd_proto (sd)->name,sd_acmd_name (req.cmd), req.cmd, req.arg,sd_state_name (sd->state)); sd->card_status |=APP_CMD ; + +if (sd_proto (sd)->acmd[req.cmd]) { +return sd_proto (sd)->acmd[req.cmd](sd, req); + } +switch (req.cmd) {case 6 :/* ACMD6: SET_BUS_WIDTH */ if (sd->spi) {
Signature · 1 line
2.41.0
[PULL 22/26] hw/sd: Add sd_cmd_ALL_SEND_CID() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
--- hw/sd/sd.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
hw/sd/sd.c +12 -11
@@ -1037,6 +1037,17 @@ static sd_rsp_type_t sd_cmd_SEND_OP_CMD(SDState *sd, SDRequest req)return sd_r1; } +static sd_rsp_type_t sd_cmd_ALL_SEND_CID (SDState *sd,SDRequest req) +{ +if (sd->state != sd_ready_state) { +return sd_invalid_state_for_cmd (sd, req); + } + + sd->state = sd_identification_state; + +return sd_r2_i; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1076,17 +1087,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)switch (req.cmd) {/* Basic commands (Class 0 and Class 1) */ -case 2 :/* CMD2: ALL_SEND_CID */ -switch (sd->state) { -case sd_ready_state: - sd->state = sd_identification_state; -return sd_r2_i; - -default : -break ; - } -break ; -case 3 :/* CMD3: SEND_RELATIVE_ADDR */ switch (sd->state) {case sd_identification_state:
@@ -2148,6 +2148,7 @@ static const SDProto sd_proto_sd = { .cmd = { [0] = sd_cmd_GO_IDLE_STATE, [1] = sd_cmd_illegal, + [2] = sd_cmd_ALL_SEND_CID, [5] = sd_cmd_illegal, [52 ... 54] = sd_cmd_illegal, [58] = sd_cmd_illegal,
Signature · 1 line
2.41.0
[PULL 04/26] hw/i2c/aspeed: Add support for buffer organization
In reply to Cédric Le GoaterFrom: Hang Yu <[email protected]>
Added support for the buffer organization option in pool buffer control register.when set to 1,The buffer is split into two parts: Lower 16 bytes for Tx and higher 16 bytes for Rx.
--- include/hw/i2c/aspeed_i2c.h | 1 + hw/i2c/aspeed_i2c.c | 4 ++++ 2 files changed, 5 insertions(+)
include/hw/i2c/aspeed_i2c.h +1 -0
@@ -143,6 +143,7 @@ REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */ SHARED_FIELD(RX_SIZE, 16, 5) SHARED_FIELD(TX_COUNT, 8, 5) FIELD(I2CD_POOL_CTRL, OFFSET, 2, 6) /* AST2400 */ + SHARED_FIELD(BUF_ORGANIZATION, 0, 1) /* AST2600 */ REG32(I2CD_BYTE_BUF, 0x20) /* Transmit/Receive Byte Buffer */ SHARED_FIELD(RX_BUF, 8, 8)SHARED_FIELD (TX_BUF ,0 ,8 )
hw/i2c/aspeed_i2c.c +4 -0
@@ -297,6 +297,10 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,RX_BUFF_EN )) {uint8_t *pool_base = aic->bus_pool_base (bus); +if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl, +BUF_ORGANIZATION )) { + pool_base +=16 ; + }for (i =0 ; i < pool_rx_count; i++) { pool_base[i] =i2c_recv (bus->bus);
Signature · 1 line
2.41.0
[PULL 16/26] hw/sd: Move proto_name to SDProto structure
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Introduce a new structure to hold the bus protocol specific
fields: SDProto. The first field is the protocol name.
Message-Id: <[email protected]>
--- include/hw/sd/sd.h | 2 ++ hw/sd/sd.c | 35 +++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-)
include/hw/sd/sd.h +2 -0
@@ -124,6 +124,8 @@ struct SDCardClass {void (*enable)(SDState *sd,bool enable);bool (*get_inserted)(SDState *sd);bool (*get_readonly)(SDState *sd); + +const struct SDProto *proto; };#define TYPE_SD_BUS "sd-bus"
hw/sd/sd.c +27 -8
@@ -87,6 +87,10 @@ enum SDCardStates { sd_disconnect_state, }; +typedef struct SDProto { +const char *name; +}SDProto ; +struct SDState {DeviceState parent_obj;
@@ -137,7 +141,6 @@ struct SDState {qemu_irq readonly_cb;qemu_irq inserted_cb;QEMUTimer *ocr_power_timer; -const char *proto_name;bool enable;uint8_t dat_lines;bool cmd_line;
@@ -145,6 +148,13 @@ struct SDState {static void sd_realize (DeviceState *dev,Error **errp); +static const struct SDProto *sd_proto (SDState *sd) +{ +SDCardClass *sc =SD_CARD_GET_CLASS (sd); + +return sc->proto; +} +static const char *sd_version_str (enum SDPhySpecificationVersion version) {static const char *sdphy_version[] = {
@@ -981,8 +991,8 @@ static bool address_in_range(SDState *sd, const char *desc,static sd_rsp_type_t sd_invalid_state_for_cmd (SDState *sd,SDRequest req) { -qemu_log_mask (LOG_GUEST_ERROR ,"SD: CMD%i in a wrong state: %s (spec %s)\n" , - req.cmd,sd_state_name (sd->state), +qemu_log_mask (LOG_GUEST_ERROR ,"%s: CMD%i in a wrong state: %s (spec %s)\n" , +sd_proto (sd)->name, req.cmd,sd_state_name (sd->state),sd_version_str (sd->spec_version));return sd_illegal;
@@ -997,7 +1007,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)* However there is no ACMD55, so we want to trace this particular case. */ if (req.cmd !=55 || sd->expecting_acmd) { -trace_sdcard_normal_command (sd->proto_name, +trace_sdcard_normal_command (sd_proto (sd)->name,sd_cmd_name (req.cmd), req.cmd, req.arg,sd_state_name (sd->state)); }
@@ -1562,7 +1572,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)static sd_rsp_type_t sd_app_command (SDState *sd,SDRequest req) { -trace_sdcard_app_command (sd->proto_name,sd_acmd_name (req.cmd), +trace_sdcard_app_command (sd_proto (sd)->name,sd_acmd_name (req.cmd), req.cmd, req.arg,sd_state_name (sd->state)); sd->card_status |=APP_CMD ;switch (req.cmd) {
@@ -1856,7 +1866,7 @@ void sd_write_byte(SDState *sd, uint8_t value)if (sd->card_status & (ADDRESS_ERROR |WP_VIOLATION ))return ; -trace_sdcard_write_data (sd->proto_name, +trace_sdcard_write_data (sd_proto (sd)->name,sd_acmd_name (sd->current_cmd), sd->current_cmd, value);switch (sd->current_cmd) {
@@ -2012,7 +2022,7 @@ uint8_t sd_read_byte(SDState *sd) io_len = (sd->ocr & (1 <<30 )) ?512 : sd->blk_len; -trace_sdcard_read_data (sd->proto_name, +trace_sdcard_read_data (sd_proto (sd)->name,sd_acmd_name (sd->current_cmd), sd->current_cmd, io_len);switch (sd->current_cmd) {
@@ -2131,6 +2141,14 @@ void sd_enable(SDState *sd, bool enable) sd->enable = enable; } +static const SDProto sd_proto_spi = { + .name ="SPI" , +}; + +static const SDProto sd_proto_sd = { + .name ="SD" , +}; +static void sd_instance_init (Object *obj) {SDState *sd =SD_CARD (obj);
@@ -2149,9 +2167,10 @@ static void sd_instance_finalize(Object *obj)static void sd_realize (DeviceState *dev,Error **errp) {SDState *sd =SD_CARD (dev); +SDCardClass *sc =SD_CARD_GET_CLASS (sd);int ret; - sd->proto_name = sd->spi ?"SPI" :"SD" ; + sc->proto = sd->spi ? &sd_proto_spi : &sd_proto_sd;switch (sd->spec_version) { case SD_PHY_SPECv1_10_VERS
Signature · 1 line
2.41.0
[PULL 03/26] hw/i2c/aspeed: Fix TXBUF transmission start position error
In reply to Cédric Le GoaterFrom: Hang Yu <[email protected]>
According to the ast2600 datasheet and the linux aspeed i2c driver, the TXBUF transmission start position should be TXBUF[0] instead of TXBUF[1],so the arg pool_start is useless,and the address is not included in TXBUF.So even if Tx Count equals zero,there is at least 1 byte data needs to be transmitted,and M_TX_CMD should not be cleared at this condition.The driver url is:
https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v5.15/drivers/i2c/busses/i2c-ast2600.c
--- hw/i2c/aspeed_i2c.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-)
hw/i2c/aspeed_i2c.c +6 -24
@@ -226,7 +226,7 @@ static int aspeed_i2c_dma_read(AspeedI2CBus *bus, uint8_t *data)return 0 ; } -static int aspeed_i2c_bus_send (AspeedI2CBus *bus,uint8_t pool_start) +static int aspeed_i2c_bus_send (AspeedI2CBus *bus) {AspeedI2CClass *aic =ASPEED_I2C_GET_CLASS (bus->controller);int ret =-1 ;
@@ -239,7 +239,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start) TX_COUNT) + 1;if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_BUFF_EN )) { -for (i = pool_start; i < pool_tx_count; i++) { +for (i =0 ; i < pool_tx_count; i++) {uint8_t *pool_base = aic->bus_pool_base (bus); trace_aspeed_i2c_bus_send("BUF", i + 1, pool_tx_count,
@@ -273,7 +273,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start) }SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_cmd,TX_DMA_EN ,0 ); }else { -trace_aspeed_i2c_bus_send ("BYTE" , pool_start,1 , +trace_aspeed_i2c_bus_send ("BYTE" ,0 ,1 , bus->regs[reg_byte_buf]); ret =i2c_send (bus->bus, bus->regs[reg_byte_buf]); }
@@ -446,10 +446,8 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)*/ static void aspeed_i2c_bus_handle_cmd (AspeedI2CBus *bus,uint64_t value) { -uint8_t pool_start =0 ;uint32_t reg_intr_sts =aspeed_i2c_bus_intr_sts_offset (bus);uint32_t reg_cmd =aspeed_i2c_bus_cmd_offset (bus); -uint32_t reg_pool_ctrl =aspeed_i2c_bus_pool_ctrl_offset (bus);uint32_t reg_dma_len =aspeed_i2c_bus_dma_len_offset (bus);if (!aspeed_i2c_check_sram (bus)) {
@@ -483,27 +481,11 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_cmd,M_START_CMD ,0 ); -/* -* The START command is also a TX command, as the slave -* address is sent on the bus. Drop the TX flag if nothing -* else needs to be sent in this sequence. -*/ -if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_BUFF_EN )) { -if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_pool_ctrl,TX_COUNT ) - ==0 ) { -SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_cmd,M_TX_CMD ,0 ); - }else { -/* -* Increase the start index in the TX pool buffer to -* skip the address byte. -*/ - pool_start++; - } - }else if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_DMA_EN )) { +if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_DMA_EN )) {if (bus->regs[reg_dma_len] ==0 ) {SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_cmd,M_TX_CMD ,0 ); } - }else { + }else if (!SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,TX_BUFF_EN )) {SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_cmd,M_TX_CMD ,0 ); }
@@ -520,7 +502,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)if (SHARED_ARRAY_FIELD_EX32 (bus->regs, reg_cmd,M_TX_CMD )) {aspeed_i2c_set_state (bus,I2CD_MTXD ); -if (aspeed_i2c_bus_send (bus, pool_start)) { +if (aspeed_i2c_bus_send (bus)) {SHARED_ARRAY_FIELD_DP32 (bus->regs, reg_intr_sts,TX_NAK ,1 );i2c_end_transfer (bus->bus); }else {
Signature · 1 line
2.41.0
[PULL 13/26] hw/sd/sdcard: Return ILLEGAL for CMD19/CMD23 prior SD spec v3.01
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
CMD19 (SEND_TUNING_BLOCK) and CMD23 (SET_BLOCK_COUNT) were added in the Physical Layer Simplified Specification v3.01. When earlier spec version is requested, we should return ILLEGAL.
Message-Id: <[email protected]>
--- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/sd/sd.c +2 -2
@@ -1263,7 +1263,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }if (sd->state == sd_transfer_state) { sd->state = sd_sendingdata_state;
@@ -1274,7 +1274,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 23 :/* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }switch (sd->state) {case sd_transfer_state:
Signature · 1 line
2.41.0
[PULL 18/26] hw/sd: Add sd_cmd_illegal() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Log illegal commands as GUEST_ERROR.
Note: we are logging back the SDIO commands (CMD5, CMD52-54).
Message-Id: <[email protected]>
--- hw/sd/sd.c | 62 +++++++++++++++++++++++------------------------------- 1 file changed, 26 insertions(+), 36 deletions(-)
hw/sd/sd.c +26 -36
@@ -1002,6 +1002,15 @@ static sd_rsp_type_t sd_invalid_state_for_cmd(SDState *sd, SDRequest req)return sd_illegal; } +static sd_rsp_type_t sd_cmd_illegal (SDState *sd,SDRequest req) +{ +qemu_log_mask (LOG_GUEST_ERROR ,"%s: Unknown CMD%i for spec %s\n" , +sd_proto (sd)->name, req.cmd, +sd_version_str (sd->spec_version)); + +return sd_illegal; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1054,15 +1063,10 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 1 :/* CMD1: SEND_OP_CMD */ -if (!sd->spi) - goto bad_cmd; - sd->state = sd_transfer_state;return sd_r1;case 2 :/* CMD2: ALL_SEND_CID */ -if (sd->spi) - goto bad_cmd;switch (sd->state) {case sd_ready_state: sd->state = sd_identification_state;
@@ -1074,8 +1078,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 3 :/* CMD3: SEND_RELATIVE_ADDR */ -if (sd->spi) - goto bad_cmd;switch (sd->state) {case sd_identification_state:case sd_standby_state:
@@ -1089,8 +1091,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 4 :/* CMD4: SEND_DSR */ -if (sd->spi) - goto bad_cmd;switch (sd->state) {case sd_standby_state:break ;
@@ -1100,9 +1100,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) }break ; -case 5 :/* CMD5: reserved for SDIO cards */ -return sd_illegal; -case 6 :/* CMD6: SWITCH_FUNCTION */ switch (sd->mode) {case sd_data_transfer_mode:
@@ -1118,8 +1115,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 7 :/* CMD7: SELECT/DESELECT_CARD */ -if (sd->spi) - goto bad_cmd;switch (sd->state) {case sd_standby_state:if (sd->rca != rca)
@@ -1249,8 +1244,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 15 :/* CMD15: GO_INACTIVE_STATE */ -if (sd->spi) - goto bad_cmd;switch (sd->mode) {case sd_data_transfer_mode:if (sd->rca != rca)
@@ -1303,7 +1296,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { - goto bad_cmd; +return sd_invalid_state_for_cmd (sd, req); }if (sd->state == sd_transfer_state) { sd->state = sd_sendingdata_state;
@@ -1314,7 +1307,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 23 :/* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { - goto bad_cmd; +return sd_invalid_state_for_cmd (sd, req); }switch (sd->state) {case sd_transfer_state:
@@ -1357,8 +1350,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 26 :/* CMD26: PROGRAM_CID */ -if (sd->spi) - goto bad_cmd;switch (sd->state) {case sd_transfer_state: sd->state = sd_receivingdata_state;
@@ -1508,15 +1499,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) }break ; - case 52 ... 54: -/* CMD52, CMD53, CMD54: reserved for SDIO cards -* (see the SDIO Simplified Specification V2.0) -* Handle as illegal command but do not complain -* on stderr, as some OSes may use these in their -* probing for presence of an SDIO card. -*/ -return sd_illegal; -/* Application specific commands (Class 8) */ case 55 :/* CMD55: APP_CMD */ switch (sd->state) {
@@ -1557,19 +1539,12 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)break ;case 58 :/* CMD58: READ_OCR (SPI) */ -if (!sd->spi) { - goto bad_cmd; - }return sd_r3;case 59 :/* CMD59: CRC_ON_OFF (SPI) */ -if (!sd->spi) { - goto bad_cmd; - }return sd_r1;default : - bad_cmd:qemu_log_mask (LOG_GUEST_ERROR ,"SD: Unknown CMD%i\n" , req.cmd);return sd_illegal; }
@@ -2156,10 +2131,25 @@ void sd_enable(SDState *sd, bool enable)static const SDProto sd_proto_spi = { .name ="SPI" , + .cmd = { + [2 ...4 ] = sd_cmd_illegal, + [5 ] = sd_cmd_illegal, + [7 ] = sd_cmd_illegal, + [15 ] = sd_cmd_illegal, + [26 ] = sd_cmd_illegal, + [52 ...54 ] = sd_cmd_illegal, + }, };static const SDProto sd_proto_sd = { .name ="SD" , + .cmd = { + [1 ] = sd_cmd_illegal, + [5 ] = sd_cmd_illegal, + [52 ...54 ] = sd_cmd_illegal, + [58 ] = sd_cmd_illegal, + [59 ] = sd_cmd_illegal, + }, };static void sd_instance_init (Object *obj)
Signature · 1 line
2.41.0
[PULL 19/26] hw/sd: Add sd_cmd_unimplemented() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
--- hw/sd/sd.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
hw/sd/sd.c +12 -9
@@ -1011,6 +1011,15 @@ static sd_rsp_type_t sd_cmd_illegal(SDState *sd, SDRequest req)return sd_illegal; } +/* Commands that are recognised but not yet implemented. */ +static sd_rsp_type_t sd_cmd_unimplemented (SDState *sd,SDRequest req) +{ +qemu_log_mask (LOG_UNIMP ,"%s: CMD%i not implemented\n" , +sd_proto (sd)->name, req.cmd); + +return sd_illegal; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1565,9 +1574,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd,switch (req.cmd) {case 6 :/* ACMD6: SET_BUS_WIDTH */ -if (sd->spi) { - goto unimplemented_spi_cmd; - }switch (sd->state) {case sd_transfer_state: sd->sd_status[0 ] &=0x3f ;
@@ -1698,12 +1704,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd,default :/* Fall back to standard commands. */ return sd_normal_command (sd, req); - - unimplemented_spi_cmd: -/* Commands that are recognised but not yet implemented in SPI mode. */ -qemu_log_mask (LOG_UNIMP ,"SD: CMD%i not implemented in SPI mode\n" , - req.cmd); -return sd_illegal; }qemu_log_mask (LOG_GUEST_ERROR ,"SD: ACMD%i in a wrong state\n" , req.cmd);
@@ -2139,6 +2139,9 @@ static const SDProto sd_proto_spi = { [26] = sd_cmd_illegal, [52 ... 54] = sd_cmd_illegal, }, + .acmd = { + [6] = sd_cmd_unimplemented, + }, };static const SDProto sd_proto_sd = {
Signature · 1 line
2.41.0
[PULL 15/26] hw/sd: When card is in wrong state, log which spec version is used
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Add the sd_version_str() helper.
--- hw/sd/sd.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
hw/sd/sd.c +16 -2
@@ -145,6 +145,19 @@ struct SDState {static void sd_realize (DeviceState *dev,Error **errp); +static const char *sd_version_str (enum SDPhySpecificationVersion version) +{ +static const char *sdphy_version[] = { + [SD_PHY_SPECv1_10_VERS] ="v1.10" , + [SD_PHY_SPECv2_00_VERS] ="v2.00" , + [SD_PHY_SPECv3_01_VERS] ="v3.01" , + }; +if (version >=ARRAY_SIZE (sdphy_version)) { +return "unsupported version" ; + } +return sdphy_version[version]; +} +static const char *sd_state_name (enum SDCardStates state) {static const char *state_name[] = {
@@ -968,8 +981,9 @@ static bool address_in_range(SDState *sd, const char *desc,static sd_rsp_type_t sd_invalid_state_for_cmd (SDState *sd,SDRequest req) { -qemu_log_mask (LOG_GUEST_ERROR ,"SD: CMD%i in a wrong state: %s\n" , - req.cmd,sd_state_name (sd->state)); +qemu_log_mask (LOG_GUEST_ERROR ,"SD: CMD%i in a wrong state: %s (spec %s)\n" , + req.cmd,sd_state_name (sd->state), +sd_version_str (sd->spec_version));return sd_illegal; }
Signature · 1 line
2.41.0
[PULL 06/26] hw/ssi: Add a "cs" property to SSIPeripheral
In reply to Cédric Le GoaterBoards will use this new property to identify the device CS line and wire the SPI controllers accordingly.
--- include/hw/ssi/ssi.h | 3 +++ hw/ssi/ssi.c | 7 +++++++ 2 files changed, 10 insertions(+)
include/hw/ssi/ssi.h +3 -0
@@ -64,6 +64,9 @@ struct SSIPeripheral {/* Chip select state */ bool cs; + +/* Chip select index */ +uint8_t cs_index; };extern const VMStateDescription vmstate_ssi_peripheral;
hw/ssi/ssi.c +7 -0
@@ -13,6 +13,7 @@*/ #include "qemu/osdep.h" +#include "hw/qdev-properties.h" #include "hw/ssi/ssi.h" #include "migration/vmstate.h" #include "qemu/module.h"
@@ -71,6 +72,11 @@ static void ssi_peripheral_realize(DeviceState *dev, Error **errp) ssc->realize (s, errp); } +static Property ssi_peripheral_properties[] = { +DEFINE_PROP_UINT8 ("cs" , SSIPeripheral, cs_index,0 ), +DEFINE_PROP_END_OF_LIST (), +}; +static void ssi_peripheral_class_init (ObjectClass *klass,void *data) {SSIPeripheralClass *ssc =SSI_PERIPHERAL_CLASS (klass);
@@ -81,6 +87,7 @@ static void ssi_peripheral_class_init(ObjectClass *klass, void *data)if (!ssc->transfer_raw) { ssc->transfer_raw = ssi_transfer_raw_default; } +device_class_set_props (dc, ssi_peripheral_properties); }static const TypeInfo ssi_peripheral_info = {
Signature · 1 line
2.41.0
[PULL 08/26] aspeed/smc: Wire CS lines at reset
In reply to Cédric Le GoaterCurrently, a set of default flash devices is created at machine init and drives defined on the QEMU command line are associated to the FMC and SPI controllers in sequence :
-drive file<file>,format=raw,if=mtd
-drive file<file1>,format=raw,if=mtd
The CS lines are wired in the same creation loop. This makes a strong assumption on the ordering and is not very flexible since only a limited set of flash devices can be defined : 1 FMC + 1 or 2 SPI, which is less than what the SoC really supports.
A better alternative would be to define the flash devices on the command line using a blockdev attached to a CS line of a SSI bus :
-blockdev node-name=fmc0,driver=file,filename=./flash.img
-device mx66u51235f,cs=0x0,bus=ssi.0,drive=fmc0However, user created flash devices are not correctly wired to their SPI controller and consequently can not be used by the machine. Fix that and wire the CS lines of all available devices when the SSI bus is reset.
--- hw/arm/aspeed.c | 5 +---- hw/ssi/aspeed_smc.c | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-)
hw/arm/aspeed.c +1 -4
@@ -307,17 +307,14 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,for (i =0 ; i < count; ++i) {DriveInfo *dinfo =drive_get (IF_MTD ,0 , unit0 + i); -qemu_irq cs_line;DeviceState *dev; dev =qdev_new (flashtype);if (dinfo) {qdev_prop_set_drive (dev,"drive" ,blk_by_legacy_dinfo (dinfo)); } +qdev_prop_set_uint8 (dev,"cs" , i);qdev_realize_and_unref (dev,BUS (s->spi), &error_fatal); - - cs_line =qdev_get_gpio_in_named (dev,SSI_GPIO_CS ,0 ); -qdev_connect_gpio_out_named (DEVICE (s),"cs" , i, cs_line); } }
hw/ssi/aspeed_smc.c +8 -0
@@ -692,6 +692,14 @@ static void aspeed_smc_reset(DeviceState *d)memset (s->regs,0 ,sizeof s->regs); } +for (i =0 ; i < asc->cs_num_max; i++) { +DeviceState *dev =ssi_get_cs (s->spi, i); +if (dev) { +qemu_irq cs_line =qdev_get_gpio_in_named (dev,SSI_GPIO_CS ,0 ); +qdev_connect_gpio_out_named (DEVICE (s),"cs" , i, cs_line); + } + } +/* Unselect all peripherals */ for (i =0 ; i < asc->cs_num_max; ++i) { s->regs[s->r_ctrl0 + i] |=CTRL_CE_STOP_ACTIVE ;
Signature · 1 line
2.41.0
[PULL 14/26] hw/sd: When card is in wrong state, log which state it is
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
We report the card is in an inconsistent state, but don't precise in which state it is. Add this information, as it is useful when debugging problems.
Since we will reuse this code, extract as sd_invalid_state_for_cmd() helper.
Message-Id: <[email protected]>
--- hw/sd/sd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
hw/sd/sd.c +9 -3
@@ -966,6 +966,14 @@ static bool address_in_range(SDState *sd, const char *desc,return true; } +static sd_rsp_type_t sd_invalid_state_for_cmd (SDState *sd,SDRequest req) +{ +qemu_log_mask (LOG_GUEST_ERROR ,"SD: CMD%i in a wrong state: %s\n" , + req.cmd,sd_state_name (sd->state)); + +return sd_illegal; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1534,9 +1542,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)return sd_illegal; } -qemu_log_mask (LOG_GUEST_ERROR ,"SD: CMD%i in a wrong state: %s\n" , - req.cmd,sd_state_name (sd->state)); -return sd_illegal; +return sd_invalid_state_for_cmd (sd, req); } static sd_rsp_type_t sd_app_command(SDState *sd,
Signature · 1 line
2.41.0
[PULL 09/26] hw/ssi: Check for duplicate CS indexes
In reply to Cédric Le GoaterThis to avoid indexes conflicts on the same SSI bus. Adapt machines using multiple devices on the same bus to avoid breakage.
--- hw/arm/stellaris.c | 4 +++- hw/arm/xilinx_zynq.c | 1 + hw/arm/xlnx-versal-virt.c | 1 + hw/arm/xlnx-zcu102.c | 2 ++ hw/microblaze/petalogix_ml605_mmu.c | 1 + hw/ssi/ssi.c | 21 +++++++++++++++++++++ 6 files changed, 29 insertions(+), 1 deletion(-)
hw/arm/stellaris.c +3 -1
@@ -1242,7 +1242,9 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)qdev_get_child_bus (sddev,"sd-bus" ), &error_fatal); - ssddev =ssi_create_peripheral (bus,"ssd0323" ); + ssddev =qdev_new ("ssd0323" ); +qdev_prop_set_uint8 (ssddev,"cs" ,1 ); +qdev_realize_and_unref (ssddev, bus, &error_fatal); gpio_d_splitter =qdev_new (TYPE_SPLIT_IRQ );qdev_prop_set_uint32 (gpio_d_splitter,"num-lines" ,2 );
hw/arm/xilinx_zynq.c +1 -0
@@ -164,6 +164,7 @@ static inline int zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,blk_by_legacy_dinfo (dinfo), &error_fatal); } +qdev_prop_set_uint8 (flash_dev,"cs" , j);qdev_realize_and_unref (flash_dev,BUS (spi), &error_fatal); cs_line =qdev_get_gpio_in_named (flash_dev,SSI_GPIO_CS ,0 );
hw/arm/xlnx-versal-virt.c +1 -0
@@ -740,6 +740,7 @@ static void versal_virt_init(MachineState *machine)qdev_prop_set_drive_err (flash_dev,"drive" ,blk_by_legacy_dinfo (dinfo), &error_fatal); } +qdev_prop_set_uint8 (flash_dev,"cs" , i);qdev_realize_and_unref (flash_dev, spi_bus, &error_fatal); cs_line =qdev_get_gpio_in_named (flash_dev,SSI_GPIO_CS ,0 );
hw/arm/xlnx-zcu102.c +2 -0
@@ -201,6 +201,7 @@ static void xlnx_zcu102_init(MachineState *machine)qdev_prop_set_drive_err (flash_dev,"drive" ,blk_by_legacy_dinfo (dinfo), &error_fatal); } +qdev_prop_set_uint8 (flash_dev,"cs" , i);qdev_realize_and_unref (flash_dev, spi_bus, &error_fatal); cs_line =qdev_get_gpio_in_named (flash_dev,SSI_GPIO_CS ,0 );
@@ -224,6 +225,7 @@ static void xlnx_zcu102_init(MachineState *machine)qdev_prop_set_drive_err (flash_dev,"drive" ,blk_by_legacy_dinfo (dinfo), &error_fatal); } +qdev_prop_set_uint8 (flash_dev,"cs" , i);qdev_realize_and_unref (flash_dev, spi_bus, &error_fatal); cs_line =qdev_get_gpio_in_named (flash_dev,SSI_GPIO_CS ,0 );
hw/microblaze/petalogix_ml605_mmu.c +1 -0
@@ -192,6 +192,7 @@ petalogix_ml605_init(MachineState *machine)blk_by_legacy_dinfo (dinfo), &error_fatal); } +qdev_prop_set_uint8 (dev,"cs" , i);qdev_realize_and_unref (dev,BUS (spi), &error_fatal); cs_line =qdev_get_gpio_in_named (dev,SSI_GPIO_CS ,0 );
hw/ssi/ssi.c +21 -0
@@ -42,10 +42,31 @@ DeviceState *ssi_get_cs(SSIBus *bus, uint8_t cs_index)return NULL ; } +static bool ssi_bus_check_address (BusState *b,DeviceState *dev,Error **errp) +{ +SSIPeripheral *s =SSI_PERIPHERAL (dev); + +if (ssi_get_cs (SSI_BUS (b), s->cs_index)) { +error_setg (errp,"CS index '0x%x' in use by a %s device" , s->cs_index, +object_get_typename (OBJECT (dev))); +return false; + } + +return true; +} + +static void ssi_bus_class_init (ObjectClass *klass,void *data) +{ +BusClass *k =BUS_CLASS (klass); + + k->check_address = ssi_bus_check_address; +} +static const TypeInfo ssi_bus_info = { .name =TYPE_SSI_BUS , .parent =TYPE_BUS , .instance_size =sizeof (SSIBus), + .class_init = ssi_bus_class_init, };static void ssi_cs_default (void *opaque,int n,int level)
Signature · 1 line
2.41.0
[PULL 26/26] hw/sd: Introduce a "sd-card" SPI variant model
In reply to Cédric Le Goaterand replace the SDState::spi attribute with a test checking the SDProto array of commands.
--- include/hw/sd/sd.h | 3 +++ hw/arm/stellaris.c | 3 +-- hw/riscv/sifive_u.c | 3 +-- hw/sd/sd.c | 54 +++++++++++++++++++++++++++++++++------------ 4 files changed, 45 insertions(+), 18 deletions(-)
include/hw/sd/sd.h +3 -0
@@ -93,6 +93,9 @@ typedef struct {#define TYPE_SD_CARD "sd-card" OBJECT_DECLARE_TYPE(SDState, SDCardClass, SD_CARD) +#define TYPE_SD_CARD_SPI "sd-card-spi" +DECLARE_INSTANCE_CHECKER(SDState, SD_CARD_SPI, TYPE_SD_CARD_SPI) +struct SDCardClass {/*< private >*/ DeviceClass parent_class;
hw/arm/stellaris.c +1 -2
@@ -1235,9 +1235,8 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) dinfo =drive_get (IF_SD ,0 ,0 ); blk = dinfo ?blk_by_legacy_dinfo (dinfo) :NULL ; - carddev =qdev_new (TYPE_SD_CARD ); + carddev =qdev_new (TYPE_SD_CARD_SPI );qdev_prop_set_drive_err (carddev,"drive" , blk, &error_fatal); -qdev_prop_set_bit (carddev,"spi" , true);qdev_realize_and_unref (carddev,qdev_get_child_bus (sddev,"sd-bus" ), &error_fatal);
hw/riscv/sifive_u.c +1 -2
@@ -674,9 +674,8 @@ static void sifive_u_machine_init(MachineState *machine) dinfo =drive_get (IF_SD ,0 ,0 ); blk = dinfo ?blk_by_legacy_dinfo (dinfo) :NULL ; - card_dev =qdev_new (TYPE_SD_CARD ); + card_dev =qdev_new (TYPE_SD_CARD_SPI );qdev_prop_set_drive_err (card_dev,"drive" , blk, &error_fatal); -qdev_prop_set_bit (card_dev,"spi" , true);qdev_realize_and_unref (card_dev,qdev_get_child_bus (sd_dev,"sd-bus" ), &error_fatal);
hw/sd/sd.c +40 -14
150 lines not on this page · raw message
Signature · 1 line
2.41.0
[PULL 20/26] hw/sd: Add sd_cmd_GO_IDLE_STATE() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
--- hw/sd/sd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
hw/sd/sd.c +12 -12
@@ -1020,6 +1020,16 @@ static sd_rsp_type_t sd_cmd_unimplemented(SDState *sd, SDRequest req)return sd_illegal; } +static sd_rsp_type_t sd_cmd_GO_IDLE_STATE (SDState *sd,SDRequest req) +{ +if (sd->state != sd_inactive_state) { + sd->state = sd_idle_state; +sd_reset (DEVICE (sd)); + } + +return sd->spi ? sd_r1 : sd_r0; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1059,18 +1069,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)switch (req.cmd) {/* Basic commands (Class 0 and Class 1) */ -case 0 :/* CMD0: GO_IDLE_STATE */ -switch (sd->state) { -case sd_inactive_state: -return sd->spi ? sd_r1 : sd_r0; - -default : - sd->state = sd_idle_state; -sd_reset (DEVICE (sd)); -return sd->spi ? sd_r1 : sd_r0; - } -break ; -case 1 :/* CMD1: SEND_OP_CMD */ sd->state = sd_transfer_state;return sd_r1;
@@ -2132,6 +2130,7 @@ void sd_enable(SDState *sd, bool enable)static const SDProto sd_proto_spi = { .name ="SPI" , .cmd = { + [0 ] = sd_cmd_GO_IDLE_STATE, [2 ...4 ] = sd_cmd_illegal, [5 ] = sd_cmd_illegal, [7 ] = sd_cmd_illegal,
@@ -2147,6 +2146,7 @@ static const SDProto sd_proto_spi = {static const SDProto sd_proto_sd = { .name ="SD" , .cmd = { + [0 ] = sd_cmd_GO_IDLE_STATE, [1 ] = sd_cmd_illegal, [5 ] = sd_cmd_illegal, [52 ...54 ] = sd_cmd_illegal,
Signature · 1 line
2.41.0
[PULL 25/26] hw/sd: Add sd_cmd_SET_BLOCK_COUNT() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
--- hw/sd/sd.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
hw/sd/sd.c +16 -14
@@ -1078,6 +1078,21 @@ static sd_rsp_type_t sd_cmd_SEND_TUNING_BLOCK(SDState *sd, SDRequest req)return sd_r1; } +static sd_rsp_type_t sd_cmd_SET_BLOCK_COUNT (SDState *sd,SDRequest req) +{ +if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { +return sd_cmd_illegal (sd, req); + } + +if (sd->state != sd_transfer_state) { +return sd_invalid_state_for_cmd (sd, req); + } + + sd->multi_blk_cnt = req.arg; + +return sd_r1; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1321,20 +1336,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) }break ; -case 23 :/* CMD23: SET_BLOCK_COUNT */ -if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -return sd_invalid_state_for_cmd (sd, req); - } -switch (sd->state) { -case sd_transfer_state: - sd->multi_blk_cnt = req.arg; -return sd_r1; - -default : -break ; - } -break ; -/* Block write commands (Class 4) */ case 24 :/* CMD24: WRITE_SINGLE_BLOCK */ case 25 :/* CMD25: WRITE_MULTIPLE_BLOCK */
@@ -2158,6 +2159,7 @@ static const SDProto sd_proto_sd = { [3] = sd_cmd_SEND_RELATIVE_ADDR, [5] = sd_cmd_illegal, [19] = sd_cmd_SEND_TUNING_BLOCK, + [23] = sd_cmd_SET_BLOCK_COUNT, [52 ... 54] = sd_cmd_illegal, [58] = sd_cmd_illegal, [59] = sd_cmd_illegal,
Signature · 1 line
2.41.0
[PULL 21/26] hw/sd: Add sd_cmd_SEND_OP_CMD() handler
In reply to Cédric Le GoaterFrom: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
--- hw/sd/sd.c | 18 +++++++++--------- hw/sd/sdmmc-internal.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-)
hw/sd/sd.c +9 -9
@@ -1030,6 +1030,13 @@ static sd_rsp_type_t sd_cmd_GO_IDLE_STATE(SDState *sd, SDRequest req)return sd->spi ? sd_r1 : sd_r0; } +static sd_rsp_type_t sd_cmd_SEND_OP_CMD (SDState *sd,SDRequest req) +{ + sd->state = sd_transfer_state; + +return sd_r1; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1069,10 +1076,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)switch (req.cmd) {/* Basic commands (Class 0 and Class 1) */ -case 1 :/* CMD1: SEND_OP_CMD */ - sd->state = sd_transfer_state; -return sd_r1; -case 2 :/* CMD2: ALL_SEND_CID */ switch (sd->state) {case sd_ready_state:
@@ -1622,11 +1625,6 @@ static sd_rsp_type_t sd_app_command(SDState *sd,break ;case 41 :/* ACMD41: SD_APP_OP_COND */ -if (sd->spi) { -/* SEND_OP_CMD */ - sd->state = sd_transfer_state; -return sd_r1; - }if (sd->state != sd_idle_state) {break ; }
@@ -2131,6 +2129,7 @@ static const SDProto sd_proto_spi = { .name = "SPI", .cmd = { [0] = sd_cmd_GO_IDLE_STATE, + [1] = sd_cmd_SEND_OP_CMD, [2 ... 4] = sd_cmd_illegal, [5] = sd_cmd_illegal, [7] = sd_cmd_illegal,
@@ -2140,6 +2139,7 @@ static const SDProto sd_proto_spi = { }, .acmd = { [6] = sd_cmd_unimplemented, + [41] = sd_cmd_SEND_OP_CMD, }, };
hw/sd/sdmmc-internal.c +1 -1
@@ -14,7 +14,7 @@const char *sd_cmd_name (uint8_t cmd) {static const char *cmd_abbrev[SDMMC_CMD_MAX ] = { - [0 ] ="GO_IDLE_STATE" , + [0 ] ="GO_IDLE_STATE" , [1 ] ="SEND_OP_CMD" , [2 ] ="ALL_SEND_CID" , [3 ] ="SEND_RELATIVE_ADDR" , [4 ] ="SET_DSR" , [5 ] ="IO_SEND_OP_COND" , [6 ] ="SWITCH_FUNC" , [7 ] ="SELECT/DESELECT_CARD" ,
Signature · 1 line
2.41.0
[PULL 24/26] hw/sd: Add sd_cmd_SEND_TUNING_BLOCK() handler
In reply to Cédric Le GoaterFrom: Joel Stanley <[email protected]>
--- hw/sd/sd.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
hw/sd/sd.c +17 -11
@@ -1062,6 +1062,22 @@ static sd_rsp_type_t sd_cmd_SEND_RELATIVE_ADDR(SDState *sd, SDRequest req) } } +static sd_rsp_type_t sd_cmd_SEND_TUNING_BLOCK (SDState *sd,SDRequest req) +{ +if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { +return sd_cmd_illegal (sd, req); + } + +if (sd->state != sd_transfer_state) { +return sd_invalid_state_for_cmd (sd, req); + } + + sd->state = sd_sendingdata_state; + sd->data_offset =0 ; + +return sd_r1; +} +static sd_rsp_type_t sd_normal_command (SDState *sd,SDRequest req) {uint32_t rca =0x0000 ;
@@ -1305,17 +1321,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) }break ; -case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ -if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -return sd_invalid_state_for_cmd (sd, req); - } -if (sd->state == sd_transfer_state) { - sd->state = sd_sendingdata_state; - sd->data_offset =0 ; -return sd_r1; - } -break ; -case 23 :/* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {return sd_invalid_state_for_cmd (sd, req);
@@ -2152,6 +2157,7 @@ static const SDProto sd_proto_sd = { [2] = sd_cmd_ALL_SEND_CID, [3] = sd_cmd_SEND_RELATIVE_ADDR, [5] = sd_cmd_illegal, + [19] = sd_cmd_SEND_TUNING_BLOCK, [52 ... 54] = sd_cmd_illegal, [58] = sd_cmd_illegal, [59] = sd_cmd_illegal,
Signature · 1 line
2.41.0
[PULL 05/26] tests/avocado/machine_aspeed.py: Update SDK images
In reply to Cédric Le GoaterSwitch to the latest v8.06 release which introduces interesting changes for the AST2600 I2C and I3C models. Also take the AST2600 A2 images instead of the default since QEMU tries to model The AST2600 A3 SoC.
--- tests/avocado/machine_aspeed.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/avocado/machine_aspeed.py +6 -6
@@ -316,8 +316,8 @@ def test_arm_ast2500_evb_sdk(self): """ image_url = ('https://github.com/AspeedTech-BMC/openbmc/releases/' - 'download/v08.01/ast2500-default-obmc.tar.gz') - image_hash = ('5375f82b4c43a79427909342a1e18b4e48bd663e38466862145d27bb358796fd') + 'download/v08.06/ast2500-default-obmc.tar.gz') + image_hash = ('e1755f3cadff69190438c688d52dd0f0d399b70a1e14b1d3d5540fc4851d38ca') image_path = self.fetch_asset(image_url, asset_hash=image_hash, algorithm='sha256') archive.extract(image_path, self.workdir)
@@ -334,8 +334,8 @@ def test_arm_ast2600_evb_sdk(self): """ image_url = ('https://github.com/AspeedTech-BMC/openbmc/releases/' - 'download/v08.01/ast2600-default-obmc.tar.gz') - image_hash = ('f12ef15e8c1f03a214df3b91c814515c5e2b2f56119021398c1dbdd626817d15') + 'download/v08.06/ast2600-a2-obmc.tar.gz') + image_hash = ('9083506135f622d5e7351fcf7d4e1c7125cee5ba16141220c0ba88931f3681a4') image_path = self.fetch_asset(image_url, asset_hash=image_hash, algorithm='sha256') archive.extract(image_path, self.workdir)
@@ -345,8 +345,8 @@ def test_arm_ast2600_evb_sdk(self): self.vm.add_args('-device', 'ds1338,bus=aspeed.i2c.bus.5,address=0x32'); self.do_test_arm_aspeed_sdk_start( - self.workdir + '/ast2600-default/image-bmc') - self.wait_for_console_pattern('nodistro.0 ast2600-default ttyS4') + self.workdir + '/ast2600-a2/image-bmc') + self.wait_for_console_pattern('nodistro.0 ast2600-a2 ttyS4') self.ssh_connect('root', '0penBmc', False) self.ssh_command('dmesg -c > /dev/null')
Signature · 1 line
2.41.0
Stefan Hajnoczi
AppliedApplied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.
Quoted 33 lines · Cédric Le Goater
The following changes since commit
17780edd81d27fcfdb7a802efc870a99788bd2fc:Merge tag 'quick-fix-pull-request' of https://gitlab.com/bsdimp/qemu into staging (2023-08-31 10:06:29 -0400)are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-aspeed-20230901for you to fetch changes up to
c3287c0f70dae07dd12322c5c8663f7b878826e7:hw/sd: Introduce a "sd-card" SPI variant model (2023-09-01 11:40:04 +0200)----------------------------------------------------------------
aspeed queue:* Fixes for the Aspeed I2C model
* New SDK image for avocado tests
* blockdev support for flash device definition
* SD refactoring preparing ground for eMMC support----------------------------------------------------------------
Cédric Le Goater (10):
aspeed: Introduce helper for 32-bit hosts limitationtests/avocado/machine_aspeed.py: Update SDK images hw/ssi: Add a "cs" property to SSIPeripheral
hw/ssi: Introduce assi_get_cs()helper
aspeed/smc: Wire CS lines at reset
hw/ssi: Check for duplicate CS indexes
aspeed: Create flash devices only when defaults are enabled
m25p80: Introduce an helper to retrieve the BlockBackend of a device
aspeed: Get the BlockBackend of FMC0 from the flash device hw/sd: Introduce a "sd-card" SPI variant model
Quoted 3 lines
Hang Yu (3):
hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode hw/i2c/aspeed: Fix TXBUF transmission start position error
Michael,
I think the two above are candidates for stable.
Thanks,
C.
Quoted 39 lines
hw/i2c/aspeed: Add support for buffer organization
Joel Stanley (1):
hw/sd: Addsd_cmd_SEND_TUNING_BLOCK()handlerPhilippe Mathieu-Daudé (12):
hw/sd/sdcard: Return ILLEGAL for CMD19/CMD23 prior SD spec v3.01 hw/sd: When card is in wrong state, log which state it is hw/sd: When card is in wrong state, log which spec version is used hw/sd: Moveproto_nameto SDProto structure
hw/sd: Introducesd_cmd_handlertype
hw/sd: Addsd_cmd_illegal()handler
hw/sd: Addsd_cmd_unimplemented()handler
hw/sd: Addsd_cmd_GO_IDLE_STATE()handler
hw/sd: Addsd_cmd_SEND_OP_CMD()handler
hw/sd: Addsd_cmd_ALL_SEND_CID()handler
hw/sd: Addsd_cmd_SEND_RELATIVE_ADDR()handler
hw/sd: Addsd_cmd_SET_BLOCK_COUNT()handlerdocs/system/arm/aspeed.rst | 35 +++- include/hw/block/flash.h | 4 + include/hw/i2c/aspeed_i2c.h | 5 +- include/hw/sd/sd.h | 5 + include/hw/ssi/ssi.h | 5 + hw/arm/aspeed.c | 40 ++--- hw/arm/stellaris.c | 7 +- hw/arm/xilinx_zynq.c | 1 + hw/arm/xlnx-versal-virt.c | 1 + hw/arm/xlnx-zcu102.c | 2 + hw/block/m25p80.c | 6 + hw/i2c/aspeed_i2c.c | 40 ++--- hw/microblaze/petalogix_ml605_mmu.c | 1 + hw/riscv/sifive_u.c | 3 +- hw/sd/sd.c | 348 ++++++++++++++++++++++-------------- hw/sd/sdmmc-internal.c | 2 +- hw/ssi/aspeed_smc.c | 8 + hw/ssi/ssi.c | 43 +++++ tests/avocado/machine_aspeed.py | 12 +- 19 files changed, 367 insertions(+), 201 deletions(-)
08.09.2023 10:09, Cédric Le Goater wrote:
..
Quoted 7 lines
Quoted 3 lines
Hang Yu (3):
hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode hw/i2c/aspeed: Fix TXBUF transmission start position errorMichael,
I think the two above are candidates for stable.
Got it. I've noticed these two in master yesterday, but thought i2c/aspeed priority is a bit lower than other stuff, - maybe wrongly.
Picked these two up now.
Thank you for making me know!
/mjt
Quoted 6 lines · Michael Tokarev
08.09.2023 10:09, Cédric Le Goater wrote:
..Quoted 4 lines
Quoted 3 lines
Hang Yu (3):
hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode hw/i2c/aspeed: Fix TXBUF transmission start position error
Quoted 7 lines
Quoted 3 lines
Michael,
I think the two above are candidates for stable.
Got it. I've noticed these two in master yesterday, but thought i2c/aspeed priority is a bit lower than other stuff, - maybe wrongly.
It is not hot material indeed but it does fix support for the latest Aspeed SDK and a lot people simply use the disto QEMU.
Quoted 1 line
Picked these two up now.
Thanks, !
C.