[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 08/14] hw/sd/sd: Allow for inverting polarities of presence a
From: |
Bernhard Beschow |
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 |
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>
>
- [PATCH 06/14] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset, (continued)
- [PATCH 06/14] hw/gpio/imx_gpio: Don't clear input GPIO values upon reset, Bernhard Beschow, 2025/01/08
- [PATCH 07/14] hw/sd/sd: Remove legacy sd_set_cb() in favor of GPIOs, Bernhard Beschow, 2025/01/08
- [PATCH 05/14] hw/pci-host/designware: Expose MSI IRQ, Bernhard Beschow, 2025/01/08
- [PATCH 10/14] hw/timer/imx_gpt: Remove unused define, Bernhard Beschow, 2025/01/08
- [PATCH 14/14] hw/gpio/imx_gpio: Turn DPRINTF() into trace events, Bernhard Beschow, 2025/01/08
- [PATCH 08/14] hw/sd/sd: Allow for inverting polarities of presence and write-protect GPIOs, Bernhard Beschow, 2025/01/08
- [PATCH 09/14] hw/char/imx_serial: Turn some DPRINTF() statements into trace events, Bernhard Beschow, 2025/01/08
- [PATCH 11/14] tests/qtest/libqos: Reuse TYPE_IMX_I2C define, Bernhard Beschow, 2025/01/08
- [PATCH 12/14] hw/i2c/imx_i2c: Convert DPRINTF() to trace events, Bernhard Beschow, 2025/01/08