[PATCH 05/23] hw/sd/sdcard: Use registerfield CSR::CURRENT_STATE definition

Philippe Mathieu-Daudé posted 23 patches 1 year, 7 months ago
Maintainers: "Philippe Mathieu-Daudé" <philmd@linaro.org>, Bin Meng <bmeng.cn@gmail.com>
There is a newer version of this series
[PATCH 05/23] hw/sd/sdcard: Use registerfield CSR::CURRENT_STATE definition
Posted by Philippe Mathieu-Daudé 1 year, 7 months ago
Use registerfield-generated definitions to update card_status.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sd/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index c528c30bcf..24415cb9f0 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1788,8 +1788,8 @@ int sd_do_command(SDState *sd, SDRequest *req,
          * (Do this now so they appear in r1 responses.)
          */
         sd->current_cmd = req->cmd;
-        sd->card_status &= ~CURRENT_STATE;
-        sd->card_status |= (last_state << 9);
+        sd->card_status = FIELD_DP32(sd->card_status, CSR,
+                                     CURRENT_STATE, last_state);
     }
 
 send_response:
-- 
2.41.0


Re: [PATCH 05/23] hw/sd/sdcard: Use registerfield CSR::CURRENT_STATE definition
Posted by Cédric Le Goater 1 year, 7 months ago
On 6/21/24 10:05 AM, Philippe Mathieu-Daudé wrote:
> Use registerfield-generated definitions to update card_status.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/sd/sd.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index c528c30bcf..24415cb9f0 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1788,8 +1788,8 @@ int sd_do_command(SDState *sd, SDRequest *req,
>            * (Do this now so they appear in r1 responses.)
>            */
>           sd->current_cmd = req->cmd;
> -        sd->card_status &= ~CURRENT_STATE;
> -        sd->card_status |= (last_state << 9);
> +        sd->card_status = FIELD_DP32(sd->card_status, CSR,
> +                                     CURRENT_STATE, last_state);
>       }
>   
>   send_response: