From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752110AbeAEP7l (ORCPT + 1 other); Fri, 5 Jan 2018 10:59:41 -0500 Received: from conssluserg-05.nifty.com ([210.131.2.90]:43720 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbeAEP7j (ORCPT ); Fri, 5 Jan 2018 10:59:39 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com w05FxMPe006061 X-Nifty-SrcIP: [209.85.217.172] X-Google-Smtp-Source: ACJfBotF4sEw2kcajFf1A3FU9l0+kbURHvp1aPKD8814MoebmZuOzCOs/ht98MFODsWYZ5epXy9Q2C+SH0X5wQlDJn4= MIME-Version: 1.0 In-Reply-To: <20180102171321.mxhcenirdx6ohbyo@ninjato> References: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> <1511540697-27387-17-git-send-email-yamada.masahiro@socionext.com> <20180102131555.z6amjfqtadkh2w77@ninjato> <20180102171321.mxhcenirdx6ohbyo@ninjato> From: Masahiro Yamada Date: Sat, 6 Jan 2018 00:58:41 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 16/22] mmc: tmio: fix never-detected card insertion bug To: Wolfram Sang Cc: linux-mmc , Wolfram Sang , Simon Horman , Yoshihiro Shimoda , Linux-Renesas , Linux Kernel Mailing List , Ulf Hansson Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Wolfram, 2018-01-03 2:13 GMT+09:00 Wolfram Sang : > >> > The TMIO mmc cannot detect the card insertion in native_hotplug mode >> > if the driver is probed without a card inserted. >> >> Hmm, it works for me without your patch just fine. Iam currently >> researching it... > > It really doesn't work for you? Does not work. > mmc_add_host -> mmc_start_host -> _mmc_detect_change -> > mmc_schedule_delayed_work -> mmc_rescan -> mmc_start_request > Correct except "-> mmc_start_request". If a card is not inserted, the power will go down. [1] So, mmc_start_request will not happen. BTW, did you understand my git-log? I am talking about the card detection by the IP-builtin circuit. I am trying to support it by the following patch: https://patchwork.kernel.org/patch/10074255/ TMIO MMC calls mmc_detect_change() [2], but please note this _never_ detects the card event. It just re-schedules mmc_rescan. [3] To detect the card insertion/removal, .get_cd hook must be implemented, but, it is fixed to mmc_gpio_get_cd. [4] Unless you had already migrated your boards to built-in CD based on my patch, GPIO is the only way to detect card events. If so, you are testing unrelated things. It is really hard to understand what is going on Renesas side, but I imagined some possibilities: - Poll the GPIO for card events -> out of interest of this patch - Use interrupt from GPIO irqchip -> ditto - The media is non-removable like eMMC -> ditto - GPIO is not set up -> mmc_gpio_get_cd() returns -ENOSYS The last case is treated as "inserted", but the card removal will not be detected. [1] http://elixir.free-electrons.com/linux/v4.15-rc6/source/drivers/mmc/core/core.c#L2818 [2] http://elixir.free-electrons.com/linux/v4.15-rc6/source/drivers/mmc/host/tmio_mmc_core.c#L656 [3] http://elixir.free-electrons.com/linux/v4.15-rc6/source/drivers/mmc/core/core.c#L1995 [4] http://elixir.free-electrons.com/linux/v4.15-rc6/source/drivers/mmc/host/tmio_mmc_core.c#L1105 -- Best Regards Masahiro Yamada