Re: [RFC PATCH 04/15] sd: emmc: Update CMD1 definition for eMMC

2021-02-12 Thread Alistair Francis
On Thu, Feb 11, 2021 at 12:17 AM Sai Pavan Boddu
 wrote:
>
> Add support to Power up the card and send response r3 in case of eMMC.
>
> Signed-off-by: Sai Pavan Boddu 
> Signed-off-by: Edgar E. Iglesias 

Acked-by: Alistair Francis 

Alistair

> ---
>  hw/sd/sd.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 57fff89..e3738b2 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1033,8 +1033,16 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, 
> SDRequest req)
>  break;
>
>  case 1:/* CMD1:   SEND_OP_CMD */
> -if (!sd->spi)
> +/* MMC: Powerup & send r3
> + * SD: send r1 in spi mode
> + */
> +if (sd->emmc) {
> +sd_ocr_powerup(sd);
> +return sd->state == sd_idle_state ?
> +   sd_r3 : sd_r0;
> +} else if (!sd->spi) {
>  goto bad_cmd;
> +}
>
>  sd->state = sd_transfer_state;
>  return sd_r1;
> --
> 2.7.4
>
>



[RFC PATCH 04/15] sd: emmc: Update CMD1 definition for eMMC

2021-02-11 Thread Sai Pavan Boddu
Add support to Power up the card and send response r3 in case of eMMC.

Signed-off-by: Sai Pavan Boddu 
Signed-off-by: Edgar E. Iglesias 
---
 hw/sd/sd.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 57fff89..e3738b2 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1033,8 +1033,16 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, 
SDRequest req)
 break;
 
 case 1:/* CMD1:   SEND_OP_CMD */
-if (!sd->spi)
+/* MMC: Powerup & send r3
+ * SD: send r1 in spi mode
+ */
+if (sd->emmc) {
+sd_ocr_powerup(sd);
+return sd->state == sd_idle_state ?
+   sd_r3 : sd_r0;
+} else if (!sd->spi) {
 goto bad_cmd;
+}
 
 sd->state = sd_transfer_state;
 return sd_r1;
-- 
2.7.4