diff mbox series

[v2,04/22] sd: emmc: update OCR fields for eMMC

Message ID 1613982039-13861-5-git-send-email-sai.pavan.boddu@xilinx.com (mailing list archive)
State New, archived
Headers show
Series eMMC support | expand

Commit Message

Sai Pavan Boddu Feb. 22, 2021, 8:20 a.m. UTC
From: Vincent Palatin <vpalatin@chromium.org>

eMMC OCR register doesn't has UHS-II field and voltage fields are
different.

Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
---
 hw/sd/sd.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

Comments

Cédric Le Goater Feb. 22, 2021, 9:51 a.m. UTC | #1
On 2/22/21 9:20 AM, Sai Pavan Boddu wrote:
> From: Vincent Palatin <vpalatin@chromium.org>
> 
> eMMC OCR register doesn't has UHS-II field and voltage fields are
> different.

Can a patch be "From" a person without a "Signed-off-by" of the same 
person ? 

C.
 
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
>
> ---
>  hw/sd/sd.c | 27 ++++++++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 42ee49c..430bea5 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -283,6 +283,15 @@ FIELD(OCR, UHS_II_CARD,                29,  1) /* Only UHS-II */
>  FIELD(OCR, CARD_CAPACITY,              30,  1) /* 0:SDSC, 1:SDHC/SDXC */
>  FIELD(OCR, CARD_POWER_UP,              31,  1)
>  
> +/*
> + * eMMC OCR register
> + */
> +FIELD(EMMC_OCR, VDD_WINDOW_0,  7, 1)
> +FIELD(EMMC_OCR, VDD_WINDOW_1,  8, 7)
> +FIELD(EMMC_OCR, VDD_WINDOW_2, 15, 9)
> +FIELD(EMMC_OCR, ACCESS_MODE,  29, 2)
> +FIELD(EMMC_OCR, POWER_UP,     31, 1)
> +
>  #define ACMD41_ENQUIRY_MASK     0x00ffffff
>  #define ACMD41_R3_MASK          (R_OCR_VDD_VOLTAGE_WIN_HI_MASK \
>                                 | R_OCR_ACCEPT_SWITCH_1V8_MASK \
> @@ -292,8 +301,16 @@ FIELD(OCR, CARD_POWER_UP,              31,  1)
>  
>  static void sd_set_ocr(SDState *sd)
>  {
> -    /* All voltages OK */
> -    sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK;
> +    if (sd->emmc) {
> +        /*
> +         * Dual Voltage eMMC card
> +         */
> +        sd->ocr = R_EMMC_OCR_VDD_WINDOW_0_MASK |
> +                  R_EMMC_OCR_VDD_WINDOW_2_MASK;
> +    } else {
> +        /* All voltages OK */
> +        sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK;
> +    }
>  }
>  
>  static void sd_ocr_powerup(void *opaque)
> @@ -521,7 +538,11 @@ static void sd_response_r1_make(SDState *sd, uint8_t *response)
>  
>  static void sd_response_r3_make(SDState *sd, uint8_t *response)
>  {
> -    stl_be_p(response, sd->ocr & ACMD41_R3_MASK);
> +    if (sd->emmc) {
> +        stl_be_p(response, sd->ocr);
> +    } else {
> +        stl_be_p(response, sd->ocr & ACMD41_R3_MASK);
> +    }
>  }
>  
>  static void sd_response_r6_make(SDState *sd, uint8_t *response)
>
Sai Pavan Boddu Feb. 22, 2021, 9:55 a.m. UTC | #2
Hi Cedric

> -----Original Message-----
> From: Cédric Le Goater <clg@kaod.org>
> Sent: Monday, February 22, 2021 3:22 PM
> To: Sai Pavan Boddu <saipava@xilinx.com>; Markus Armbruster
> <armbru@redhat.com>; Kevin Wolf <kwolf@redhat.com>; Max Reitz
> <mreitz@redhat.com>; Vladimir Sementsov-Ogievskiy
> <vsementsov@virtuozzo.com>; Eric Blake <eblake@redhat.com>; Joel Stanley
> <joel@jms.id.au>; Vincent Palatin <vpalatin@chromium.org>; Dr. David Alan
> Gilbert <dgilbert@redhat.com>; Thomas Huth <thuth@redhat.com>; Stefan
> Hajnoczi <stefanha@redhat.com>; Peter Maydell <peter.maydell@linaro.org>;
> Alistair Francis <alistair.francis@wdc.com>; Edgar Iglesias <edgari@xilinx.com>;
> Luc Michel <luc.michel@greensocs.com>; Paolo Bonzini
> <pbonzini@redhat.com>
> Cc: qemu-block@nongnu.org; qemu-devel@nongnu.org; Sai Pavan Boddu
> <saipava@xilinx.com>
> Subject: Re: [PATCH v2 04/22] sd: emmc: update OCR fields for eMMC
> 
> On 2/22/21 9:20 AM, Sai Pavan Boddu wrote:
> > From: Vincent Palatin <vpalatin@chromium.org>
> >
> > eMMC OCR register doesn't has UHS-II field and voltage fields are
> > different.
> 
> Can a patch be "From" a person without a "Signed-off-by" of the same person ?
[Sai Pavan Boddu] No I should not be like this. My mistake, I would respin the series with corrections. Few other patches may have this after the split I did.

Regards,
Sai Pavan
> 
> C.
> 
> > Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
> >
> > ---
> >  hw/sd/sd.c | 27 ++++++++++++++++++++++++---
> >  1 file changed, 24 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> > index 42ee49c..430bea5 100644
> > --- a/hw/sd/sd.c
> > +++ b/hw/sd/sd.c
> > @@ -283,6 +283,15 @@ FIELD(OCR, UHS_II_CARD,                29,  1) /* Only
> UHS-II */
> >  FIELD(OCR, CARD_CAPACITY,              30,  1) /* 0:SDSC, 1:SDHC/SDXC */
> >  FIELD(OCR, CARD_POWER_UP,              31,  1)
> >
> > +/*
> > + * eMMC OCR register
> > + */
> > +FIELD(EMMC_OCR, VDD_WINDOW_0,  7, 1)
> > +FIELD(EMMC_OCR, VDD_WINDOW_1,  8, 7)
> > +FIELD(EMMC_OCR, VDD_WINDOW_2, 15, 9)
> > +FIELD(EMMC_OCR, ACCESS_MODE,  29, 2)
> > +FIELD(EMMC_OCR, POWER_UP,     31, 1)
> > +
> >  #define ACMD41_ENQUIRY_MASK     0x00ffffff
> >  #define ACMD41_R3_MASK          (R_OCR_VDD_VOLTAGE_WIN_HI_MASK \
> >                                 | R_OCR_ACCEPT_SWITCH_1V8_MASK \
> > @@ -292,8 +301,16 @@ FIELD(OCR, CARD_POWER_UP,              31,  1)
> >
> >  static void sd_set_ocr(SDState *sd)
> >  {
> > -    /* All voltages OK */
> > -    sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK;
> > +    if (sd->emmc) {
> > +        /*
> > +         * Dual Voltage eMMC card
> > +         */
> > +        sd->ocr = R_EMMC_OCR_VDD_WINDOW_0_MASK |
> > +                  R_EMMC_OCR_VDD_WINDOW_2_MASK;
> > +    } else {
> > +        /* All voltages OK */
> > +        sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK;
> > +    }
> >  }
> >
> >  static void sd_ocr_powerup(void *opaque) @@ -521,7 +538,11 @@ static
> > void sd_response_r1_make(SDState *sd, uint8_t *response)
> >
> >  static void sd_response_r3_make(SDState *sd, uint8_t *response)  {
> > -    stl_be_p(response, sd->ocr & ACMD41_R3_MASK);
> > +    if (sd->emmc) {
> > +        stl_be_p(response, sd->ocr);
> > +    } else {
> > +        stl_be_p(response, sd->ocr & ACMD41_R3_MASK);
> > +    }
> >  }
> >
> >  static void sd_response_r6_make(SDState *sd, uint8_t *response)
> >
Philippe Mathieu-Daudé Feb. 22, 2021, 11:59 a.m. UTC | #3
On 2/22/21 10:55 AM, Sai Pavan Boddu wrote:
> Hi Cedric
> 
>> -----Original Message-----
>> From: Cédric Le Goater <clg@kaod.org>
>> Sent: Monday, February 22, 2021 3:22 PM
>> To: Sai Pavan Boddu <saipava@xilinx.com>; Markus Armbruster
>> <armbru@redhat.com>; Kevin Wolf <kwolf@redhat.com>; Max Reitz
>> <mreitz@redhat.com>; Vladimir Sementsov-Ogievskiy
>> <vsementsov@virtuozzo.com>; Eric Blake <eblake@redhat.com>; Joel Stanley
>> <joel@jms.id.au>; Vincent Palatin <vpalatin@chromium.org>; Dr. David Alan
>> Gilbert <dgilbert@redhat.com>; Thomas Huth <thuth@redhat.com>; Stefan
>> Hajnoczi <stefanha@redhat.com>; Peter Maydell <peter.maydell@linaro.org>;
>> Alistair Francis <alistair.francis@wdc.com>; Edgar Iglesias <edgari@xilinx.com>;
>> Luc Michel <luc.michel@greensocs.com>; Paolo Bonzini
>> <pbonzini@redhat.com>
>> Cc: qemu-block@nongnu.org; qemu-devel@nongnu.org; Sai Pavan Boddu
>> <saipava@xilinx.com>
>> Subject: Re: [PATCH v2 04/22] sd: emmc: update OCR fields for eMMC
>>
>> On 2/22/21 9:20 AM, Sai Pavan Boddu wrote:
>>> From: Vincent Palatin <vpalatin@chromium.org>
>>>
>>> eMMC OCR register doesn't has UHS-II field and voltage fields are
>>> different.
>>
>> Can a patch be "From" a person without a "Signed-off-by" of the same person ?
> [Sai Pavan Boddu] No I should not be like this. My mistake, I would respin the series with corrections. Few other patches may have this after the split I did.

Please wait for more review before respining for this detail.
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 42ee49c..430bea5 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -283,6 +283,15 @@  FIELD(OCR, UHS_II_CARD,                29,  1) /* Only UHS-II */
 FIELD(OCR, CARD_CAPACITY,              30,  1) /* 0:SDSC, 1:SDHC/SDXC */
 FIELD(OCR, CARD_POWER_UP,              31,  1)
 
+/*
+ * eMMC OCR register
+ */
+FIELD(EMMC_OCR, VDD_WINDOW_0,  7, 1)
+FIELD(EMMC_OCR, VDD_WINDOW_1,  8, 7)
+FIELD(EMMC_OCR, VDD_WINDOW_2, 15, 9)
+FIELD(EMMC_OCR, ACCESS_MODE,  29, 2)
+FIELD(EMMC_OCR, POWER_UP,     31, 1)
+
 #define ACMD41_ENQUIRY_MASK     0x00ffffff
 #define ACMD41_R3_MASK          (R_OCR_VDD_VOLTAGE_WIN_HI_MASK \
                                | R_OCR_ACCEPT_SWITCH_1V8_MASK \
@@ -292,8 +301,16 @@  FIELD(OCR, CARD_POWER_UP,              31,  1)
 
 static void sd_set_ocr(SDState *sd)
 {
-    /* All voltages OK */
-    sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK;
+    if (sd->emmc) {
+        /*
+         * Dual Voltage eMMC card
+         */
+        sd->ocr = R_EMMC_OCR_VDD_WINDOW_0_MASK |
+                  R_EMMC_OCR_VDD_WINDOW_2_MASK;
+    } else {
+        /* All voltages OK */
+        sd->ocr = R_OCR_VDD_VOLTAGE_WIN_HI_MASK;
+    }
 }
 
 static void sd_ocr_powerup(void *opaque)
@@ -521,7 +538,11 @@  static void sd_response_r1_make(SDState *sd, uint8_t *response)
 
 static void sd_response_r3_make(SDState *sd, uint8_t *response)
 {
-    stl_be_p(response, sd->ocr & ACMD41_R3_MASK);
+    if (sd->emmc) {
+        stl_be_p(response, sd->ocr);
+    } else {
+        stl_be_p(response, sd->ocr & ACMD41_R3_MASK);
+    }
 }
 
 static void sd_response_r6_make(SDState *sd, uint8_t *response)