sdcard: Allow commands valid in SPI mode
From the "Physical Layer Simplified Specification Version 1.10"
  Chapter 7.3 "SPI Mode Transaction Packets"
    Table 57: "Commands and arguments"
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20180607180641.874-3-f4bug@amsat.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
			
			
This commit is contained in:
		
							parent
							
								
									9e1245795f
								
							
						
					
					
						commit
						e2fce16edb
					
				
							
								
								
									
										14
									
								
								hw/sd/sd.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								hw/sd/sd.c
									
									
									
									
									
								
							@ -960,8 +960,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 | 
				
			|||||||
        return sd_illegal;
 | 
					        return sd_illegal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case 6:	/* CMD6:   SWITCH_FUNCTION */
 | 
					    case 6:	/* CMD6:   SWITCH_FUNCTION */
 | 
				
			||||||
        if (sd->spi)
 | 
					 | 
				
			||||||
            goto bad_cmd;
 | 
					 | 
				
			||||||
        switch (sd->mode) {
 | 
					        switch (sd->mode) {
 | 
				
			||||||
        case sd_data_transfer_mode:
 | 
					        case sd_data_transfer_mode:
 | 
				
			||||||
            sd_function_switch(sd, req.arg);
 | 
					            sd_function_switch(sd, req.arg);
 | 
				
			||||||
@ -1190,9 +1188,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* Block write commands (Class 4) */
 | 
					    /* Block write commands (Class 4) */
 | 
				
			||||||
    case 24:	/* CMD24:  WRITE_SINGLE_BLOCK */
 | 
					    case 24:	/* CMD24:  WRITE_SINGLE_BLOCK */
 | 
				
			||||||
        if (sd->spi) {
 | 
					 | 
				
			||||||
            goto unimplemented_spi_cmd;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        switch (sd->state) {
 | 
					        switch (sd->state) {
 | 
				
			||||||
        case sd_transfer_state:
 | 
					        case sd_transfer_state:
 | 
				
			||||||
            /* Writing in SPI mode not implemented.  */
 | 
					            /* Writing in SPI mode not implemented.  */
 | 
				
			||||||
@ -1217,9 +1212,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 | 
				
			|||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case 25:	/* CMD25:  WRITE_MULTIPLE_BLOCK */
 | 
					    case 25:	/* CMD25:  WRITE_MULTIPLE_BLOCK */
 | 
				
			||||||
        if (sd->spi) {
 | 
					 | 
				
			||||||
            goto unimplemented_spi_cmd;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        switch (sd->state) {
 | 
					        switch (sd->state) {
 | 
				
			||||||
        case sd_transfer_state:
 | 
					        case sd_transfer_state:
 | 
				
			||||||
            /* Writing in SPI mode not implemented.  */
 | 
					            /* Writing in SPI mode not implemented.  */
 | 
				
			||||||
@ -1259,9 +1251,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 | 
				
			|||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case 27:	/* CMD27:  PROGRAM_CSD */
 | 
					    case 27:	/* CMD27:  PROGRAM_CSD */
 | 
				
			||||||
        if (sd->spi) {
 | 
					 | 
				
			||||||
            goto unimplemented_spi_cmd;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        switch (sd->state) {
 | 
					        switch (sd->state) {
 | 
				
			||||||
        case sd_transfer_state:
 | 
					        case sd_transfer_state:
 | 
				
			||||||
            sd->state = sd_receivingdata_state;
 | 
					            sd->state = sd_receivingdata_state;
 | 
				
			||||||
@ -1371,9 +1360,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /* Lock card commands (Class 7) */
 | 
					    /* Lock card commands (Class 7) */
 | 
				
			||||||
    case 42:	/* CMD42:  LOCK_UNLOCK */
 | 
					    case 42:	/* CMD42:  LOCK_UNLOCK */
 | 
				
			||||||
        if (sd->spi) {
 | 
					 | 
				
			||||||
            goto unimplemented_spi_cmd;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        switch (sd->state) {
 | 
					        switch (sd->state) {
 | 
				
			||||||
        case sd_transfer_state:
 | 
					        case sd_transfer_state:
 | 
				
			||||||
            sd->state = sd_receivingdata_state;
 | 
					            sd->state = sd_receivingdata_state;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user