qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Bin Meng" <bmeng.cn@gmail.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Andrey Smirnov" <andrew.smirnov@gmail.com>,
	"Jean-Christophe Dubois" <jcd@tribudubois.net>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	qemu-block@nongnu.org, "Laurent Vivier" <lvivier@redhat.com>,
	qemu-arm@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 08/14] hw/sd/sd: Allow for inverting polarities of presence and write-protect GPIOs
Date: Thu, 09 Jan 2025 16:20:13 +0000	[thread overview]
Message-ID: <FBA535B4-8191-4CEB-905F-FA4C3416048C@gmail.com> (raw)
In-Reply-To: <342ca371-3e14-4108-9c45-e15cda51b9ca@linaro.org>



Am 9. Januar 2025 11:40:10 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>Hi Bernhard,
>
>On 8/1/25 10:25, Bernhard Beschow wrote:
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>>   hw/sd/sd.c | 12 ++++++++----
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>
>
>> @@ -876,8 +878,8 @@ static void sd_reset(DeviceState *dev)
>>       sd->cmd_line = true;
>>       sd->multi_blk_cnt = 0;
>>   -    qemu_set_irq(sd->readonly_cb, sd_get_readonly(sd));
>> -    qemu_set_irq(sd->inserted_cb, sd_get_inserted(sd));
>> +    qemu_set_irq(sd->readonly_cb, sd_get_readonly(sd) ^ sd->readonly_active_low);
>
>Please embed in sd_get_readonly(),
>
>> +    qemu_set_irq(sd->inserted_cb, sd_get_inserted(sd) ^ sd->inserted_active_low);
>
>and sd_get_inserted().

Are you sure? I deliberately implemented it as is because embedding would change the internal logic of the device as well as SDCardClass::{get_inserted, get_readonly}.

Best regards,
Bernhard

>
>>   }
>>     static void sd_cardchange(void *opaque, bool load, Error **errp)
>> @@ -896,9 +898,9 @@ static void sd_cardchange(void *opaque, bool load, Error **errp)
>>       }
>>         if (sd->me_no_qdev_me_kill_mammoth_with_rocks) {
>> -        qemu_set_irq(sd->inserted_cb, inserted);
>> +        qemu_set_irq(sd->inserted_cb, inserted ^ sd->inserted_active_low);
>
>Use sd_get_inserted(),
>
>>           if (inserted) {
>> -            qemu_set_irq(sd->readonly_cb, readonly);
>> +            qemu_set_irq(sd->readonly_cb, readonly ^ sd->readonly_active_low);
>
>and sd_get_readonly() here.
>
>>           }
>>       } else {
>>           sdbus = SD_BUS(qdev_get_parent_bus(dev));
>> @@ -2797,6 +2799,8 @@ static void emmc_realize(DeviceState *dev, Error **errp)
>>     static const Property sdmmc_common_properties[] = {
>>       DEFINE_PROP_DRIVE("drive", SDState, blk),
>> +    DEFINE_PROP_BOOL("cd-active-low", SDState, inserted_active_low, false),
>> +    DEFINE_PROP_BOOL("wp-active-low", SDState, readonly_active_low, false),
>>   };
>With the requested changes:
>Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>


  reply	other threads:[~2025-01-09 16:20 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08  9:25 [PATCH 00/14] i.MX and SDHCI improvements Bernhard Beschow
2025-01-08  9:25 ` [PATCH 01/14] hw/sd/sdhci: Set SDHC_NIS_DMA bit when appropriate Bernhard Beschow
2025-01-09 12:10   ` Philippe Mathieu-Daudé
2025-01-08  9:25 ` [PATCH 02/14] hw/char/imx_serial: Fix reset value of UFCR register Bernhard Beschow
2025-01-08  9:25 ` [PATCH 03/14] hw/char/imx_serial: Update all state before restarting ageing timer Bernhard Beschow
2025-01-08  9:25 ` [PATCH 04/14] hw/core: Introduce TYPE_SHARED_IRQ Bernhard Beschow
2025-01-08 13:53   ` BALATON Zoltan
2025-01-09  9:14     ` Bernhard Beschow
2025-01-08 14:26   ` Bernhard Beschow
2025-01-09 11:43     ` David Woodhouse
2025-01-08  9:25 ` [PATCH 05/14] hw/pci-host/designware: Expose MSI IRQ Bernhard Beschow
2025-01-08  9:25 ` [PATCH 06/14] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset Bernhard Beschow
2025-01-08  9:25 ` [PATCH 07/14] hw/sd/sd: Remove legacy sd_set_cb() in favor of GPIOs Bernhard Beschow
2025-01-09 11:37   ` Philippe Mathieu-Daudé
2025-01-08  9:25 ` [PATCH 08/14] hw/sd/sd: Allow for inverting polarities of presence and write-protect GPIOs Bernhard Beschow
2025-01-09 11:40   ` Philippe Mathieu-Daudé
2025-01-09 16:20     ` Bernhard Beschow [this message]
2025-01-12 18:06       ` Philippe Mathieu-Daudé
2025-01-16 23:20         ` Bernhard Beschow
2025-01-17 17:24           ` Philippe Mathieu-Daudé
2025-01-08  9:25 ` [PATCH 09/14] hw/char/imx_serial: Turn some DPRINTF() statements into trace events Bernhard Beschow
2025-01-09 11:42   ` Philippe Mathieu-Daudé
2025-01-08  9:25 ` [PATCH 10/14] hw/timer/imx_gpt: Remove unused define Bernhard Beschow
2025-01-08 16:21   ` Philippe Mathieu-Daudé
2025-01-08  9:25 ` [PATCH 11/14] tests/qtest/libqos: Reuse TYPE_IMX_I2C define Bernhard Beschow
2025-01-09 11:58   ` Philippe Mathieu-Daudé
2025-01-09 14:59   ` Fabiano Rosas
2025-01-08  9:25 ` [PATCH 12/14] hw/i2c/imx_i2c: Convert DPRINTF() to trace events Bernhard Beschow
2025-01-09 11:43   ` Philippe Mathieu-Daudé
2025-01-09 11:56     ` Philippe Mathieu-Daudé
2025-01-09 12:38       ` Philippe Mathieu-Daudé
2025-01-09 16:16         ` Bernhard Beschow
2025-01-08  9:25 ` [PATCH 13/14] hw/misc/imx6_src: " Bernhard Beschow
2025-01-09 11:44   ` Philippe Mathieu-Daudé
2025-01-08  9:25 ` [PATCH 14/14] hw/gpio/imx_gpio: Turn DPRINTF() into " Bernhard Beschow
2025-01-09 11:57   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FBA535B4-8191-4CEB-905F-FA4C3416048C@gmail.com \
    --to=shentey@gmail.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=bmeng.cn@gmail.com \
    --cc=farosas@suse.de \
    --cc=jcd@tribudubois.net \
    --cc=linux@roeck-us.net \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).