On Fri, Sep 30, 2022 at 05:33:15PM +0200, Ahmad Fatoum wrote:
> We didn't care much for broken-cd so far, still we have some drivers
> implementing the card_present callback, which we should ignore when
> card-detect is marked broken.
> 
> Signed-off-by: Ahmad Fatoum <[email protected]>
> ---
> v1 -> v2:
>   - new patch
> ---
>  drivers/mci/mci-core.c | 12 ++++++++----
>  include/mci.h          |  1 +
>  2 files changed, 9 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 8c08a4f61f63..5f4457bab3df 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1750,10 +1750,13 @@ static int mci_card_probe(struct mci *mci)
>       int i, rc, disknum, ret;
>       bool has_bootpart = false;
>  
> -     if (host->card_present && !host->card_present(host) &&
> -         !host->non_removable) {
> -             dev_err(&mci->dev, "no card inserted\n");
> -             return -ENODEV;
> +     if (host->card_present && !host->card_present(host) && 
> !host->non_removable) {
> +             if (!host->broken_cd) {
> +                     dev_err(&mci->dev, "no card inserted\n");
> +                     return -ENODEV;
> +             }
> +
> +             dev_info(&mci->dev, "no card inserted (ignoring)\n");
>       }
>  
>       ret = regulator_enable(host->supply);
> @@ -2043,6 +2046,7 @@ void mci_of_parse_node(struct mci_host *host,
>               }
>       }
>  
> +     host->broken_cd = of_property_read_bool(np, "broken-cd");
>       host->non_removable = of_property_read_bool(np, "non-removable");
>       host->no_sd = of_property_read_bool(np, "no-sd");
>       host->disable_wp = of_property_read_bool(np, "disable-wp");
> diff --git a/include/mci.h b/include/mci.h
> index 2098b4fbf084..d949310fac30 100644
> --- a/include/mci.h
> +++ b/include/mci.h
> @@ -404,6 +404,7 @@ struct mci_host {
>       unsigned max_req_size;
>       unsigned dsr_val;       /**< optional dsr value */
>       int use_dsr;            /**< optional dsr usage flag */
> +     int broken_cd;          /**< card detect is broken */
>       bool non_removable;     /**< device is non removable */
>       bool no_sd;             /**< do not send SD commands during 
> initialization */
>       bool disable_wp;        /**< ignore write-protect detection logic */
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Reply via email to