Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp74247imu; Tue, 8 Jan 2019 14:59:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN4I7LpQ+vKR8Hz1OxHAC4x4bdVl4iO+QMfw3fcBbCgfmOI5J4yAabi01nDoePIDaAQGG0BZ X-Received: by 2002:a17:902:d68c:: with SMTP id v12mr3625264ply.4.1546988352355; Tue, 08 Jan 2019 14:59:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546988352; cv=none; d=google.com; s=arc-20160816; b=wA8pBFGeKvoEnqkYs7U1lgpMdo0kb7gqZGDbwSZ9e9Oxcw6EeGB/sYHhRremU5Scm/ ywNZ6KgxFIhk71QauracXtAKzL9p880V9LEAM/FOXvGuV6YaB6gJuhp3QZW0bcMqa7oR pFLQswkY/KE5wmw4IwVAiMUPMiqxYRwpbQkJ7PxRzivSYOEz8CtpYnkuGr6ZcFpp0AIj Ikhacktrl4IQCfAhHk9Upzgblh7H9v6yNwRZk9UMzISVPqbefxcTqIRZnFbkPe/oqxE7 cODfxPYG/mmZMYKK9o7Irmz8x9LXplszlrwRW7mfbhP8x0PLLHfUVSnO/gRS9JvDrs18 fD+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3FszoKRoii4/tLSRpYfFx7gzdLe873cr0aXmZDyBbvM=; b=ruVI9blqnMf8Il3QN/+WS1f1t3pz3EWA8qvByF3mRoDTolcHnwv4Iayq5ahMTqAVL8 zdxLgJ7tJoo76K5wi77MD75YNwhUXuqiQdFWM1qjnnN1gm8GiqmV8eFAujHF68OQS4a1 ItvwMU3SDrgynr8+F0tzVJ0C86n/9eInFXJ91vf/VaA0sz3NR799lJjXlB9x17T+eda5 qDv/mDrRED9kSjpeH9JG6VLiFZYE4dfb0eLA7PZT4BaTV7WqoH3samscBTLmG7UQrQPD MTkU2l3NR6v8HhR991k3eLvVcbPS23XBictHNwokbM9SBlPrWyk7MHicyXnI/fbnA9B+ UVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=eSElZoQn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d90si19775691pld.148.2019.01.08.14.58.57; Tue, 08 Jan 2019 14:59:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=eSElZoQn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729829AbfAHWUY (ORCPT + 99 others); Tue, 8 Jan 2019 17:20:24 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:46210 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729288AbfAHWUX (ORCPT ); Tue, 8 Jan 2019 17:20:23 -0500 Received: by mail-ot1-f68.google.com with SMTP id w25so4947415otm.13; Tue, 08 Jan 2019 14:20:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3FszoKRoii4/tLSRpYfFx7gzdLe873cr0aXmZDyBbvM=; b=eSElZoQn2DIH72z1EWOtHQjqzOkOhH5QnFfqy7b9Hhs3Ok5QLq26EFK7TQXK9PIeNc dRkbSaZRdX31zO07z4sYC53kT2ixhtlWrUrK/6qXWo0pGq74ijj9KxcsHSl3CAX+dzqr HcTPexMTO25vmu0T1YzJU2W+lHmnlQOiML/fXxEeo5VnCsUMFO6x2cho4XNJN/fDrf19 kle0rtYJ/UzUtk6TD2E+brpt86zSh0i2LipeHeexFeB1rl+9tvD9Ta8uVraqWz82b6Fn Z6BUBkv0WiMgf7Ix1kZqlmFmV6Y+Q0OI7mDhbRQyy4ln3DR9gbXBHfHssCq6ni2dTUq/ PORA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3FszoKRoii4/tLSRpYfFx7gzdLe873cr0aXmZDyBbvM=; b=h/yjbe8BQdhyUnkifXdxU6WgXGibCqY2Sf3Mg7YpJUEk42CwGdZ0ZYyB3KCVIEK/L9 Ds8NYWRdAqiVk2auRmLiVq31agERWTHW0lfvK26/rYBNiAZJTBlXFFLPhOOUSea2z59d mO9FBIzOGboObViAcNj83e/+OU257RH1nhLZ3XxZB95ZsftoaZ+FyPvMiVowyq8B1yho zR6zqpvRaQ0WlbOS+fNykhRFsi5zLOwLiIlYWlhycpUWnhFIHcVrUzsaM9zDzjjHmswd +Is3e4ZqGFxpUqa83X+VcLfgwZCs3x0kQblsf3MfbUQmCkFVEtUjrNzCsFzX/4UUtKbu JKNQ== X-Gm-Message-State: AJcUukcNWXxGMGAO27r8lqvBC27ONtnETXitb7NgH1qDFsxMAlbI5gIe P5mSQTzQVDIsLMoN6jMG/ut3PX8Ugffz6NEIDPQ= X-Received: by 2002:a9d:a48:: with SMTP id 66mr2392346otg.308.1546986022444; Tue, 08 Jan 2019 14:20:22 -0800 (PST) MIME-Version: 1.0 References: <20190101194414.24766-1-martin.blumenstingl@googlemail.com> <20190101194414.24766-2-martin.blumenstingl@googlemail.com> In-Reply-To: From: Martin Blumenstingl Date: Tue, 8 Jan 2019 23:20:11 +0100 Message-ID: Subject: Re: [PATCH 1/1] mmc: core: don't override the CD GPIO level when "cd-inverted" is set To: Linus Walleij Cc: "open list:GPIO SUBSYSTEM" , linux-mmc , Guenter Roeck , Bartosz Golaszewski , Ulf Hansson , "open list:ARM/Amlogic Meson..." , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On Thu, Jan 3, 2019 at 11:06 PM Linus Walleij wrote: > > On Tue, Jan 1, 2019 at 8:44 PM Martin Blumenstingl > wrote: > > > Since commit 89a5e15bcba87d ("gpio/mmc/of: Respect polarity in the device > > tree") gpiolib-of parses the "cd-gpios" property and flips the polarity > > if "cd-inverted" is also set. This results in the "cd-inverted" property > > being evaluated twice, which effectively makes it a no-op: > > - first in drivers/gpio/gpiolib-of.c (of_xlate_and_get_gpiod_flags) when > > setting up the CD GPIO > > - then again in drivers/mmc/core/slot-gpio.c (mmc_gpio_get_cd) when > > reading the CD GPIO value at runtime > > > > On boards which are using device-tree with the "cd-inverted" property > > being set any inserted card are not detected anymore. This is due to the > > MMC core treating the CD GPIO with the wrong polarity. > > > > Disable "override_cd_active_level" for the card detection GPIO which is > > parsed using mmc_of_parse. This fixes SD card detection on the boards > > which are currently using the "cd-inverted" device-tree property (tested > > on Meson8b Odroid-C1 and Meson8b EC-100). > > > > This does not remove the CD GPIO inversion logic from the MMC core > > because there's at least one driver (sdhci-pci-core for Intel BayTrail > > based boards) which still passes "override_cd_active_level = true" to > > mmc_gpiod_request_cd(). Due to lack of hardware for testing this is left > > untouched. > > In the future the GPIO inversion logic for both, card and read-only > > detection can be removed once no driver is using it anymore. > > > > Fixes: 89a5e15bcba87d ("gpio/mmc/of: Respect polarity in the device tree") > > Signed-off-by: Martin Blumenstingl > > OK two steps forward, one step back, that's a good fix for now, I > can fix it properly for v4.22. > Reviewed-by: Linus Walleij great, thanks for reviewing this! feel free to keep me CC'ed on the "cleanup patches". I can review them if you don't mind that I usually need a few days to do that Regards Martin