From patchwork Mon Jun 10 18:53:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10985307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0E511398 for ; Mon, 10 Jun 2019 18:54:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF93E28759 for ; Mon, 10 Jun 2019 18:54:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C39E42876E; Mon, 10 Jun 2019 18:54:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FB5828759 for ; Mon, 10 Jun 2019 18:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388564AbfFJSya (ORCPT ); Mon, 10 Jun 2019 14:54:30 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:38321 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387805AbfFJSya (ORCPT ); Mon, 10 Jun 2019 14:54:30 -0400 Received: by mail-it1-f193.google.com with SMTP id e25so740229itk.3 for ; Mon, 10 Jun 2019 11:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=daXs+Zg5JpwmvESTwSzf5RK4ZRVQCRqGZBkG95Vym1M=; b=XOsFbF7g+awpsBdgzHfH8P/28fJNJjNhXimq9Up5pVmSfDU0fwNM5F6pLhQXpGc8GG TMRbaNyazBpfStpSX+zSD4so0HCQ7ThrF3MTUSoYZ95pjUD+l4b+du8psedaFbjddUeD yX/zDbgHnGzN9ud6eAaHJDmEWr/3jP4vtx4Cw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=daXs+Zg5JpwmvESTwSzf5RK4ZRVQCRqGZBkG95Vym1M=; b=m2fI2TDiGZsRvXe/TZS/UufVkEWYqwXlyb6DKVxaS3672M5gYQ/gDvdUl7kzMNTRY0 aNFfOiP/Y4JE8OSJOCjoqcJ4ZCvvBKquBi8uspjoHqdXeSRA9TDnNemR7rBynYzPa+ME /U01rHbYpGNgYv9rEfl+KJ6y6WazH/KQEOTyXsgUL1s30Mj5byUloDpAHPGOmn8pFx5J kFbMiK1e8FmbRZfJj/aiWaUore7pL7i7Zoh0D0wm8xAElvMfcQwsY5BurUPKKCq/FUR5 rDQShuKRFjy5ssffmcZjSNnLOJpFcIv5ZPY6Mkq4+zoVqLaLq3Ja3eYIKQCcD70SH6Z/ 9ZwQ== X-Gm-Message-State: APjAAAWOhDtTOxQLO3TJMxvJvSe6TbUuzbRy1o0Om+TPtAH3DXqFyo37 w824/t6NRQPXoAIhAJ9EcBOOGeG/j30= X-Google-Smtp-Source: APXvYqxsczNm4XKbk5o9HtKx57BlZ6zZ8Ncz/ayRFUvobSV3RUF/A0TzU7Di7woJOM4m1Sgqdb6jRw== X-Received: by 2002:a24:2b0f:: with SMTP id h15mr12121916ita.99.1560192869752; Mon, 10 Jun 2019 11:54:29 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id t133sm4107359iof.21.2019.06.10.11.54.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 11:54:29 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org Cc: ernest.zhang@bayhubtech.com, djkurtz@chromium.org, Raul E Rangel , linux-kernel@vger.kernel.org, Adrian Hunter , Ulf Hansson Subject: [PATCH 1/3] mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning Date: Mon, 10 Jun 2019 12:53:51 -0600 Message-Id: <20190610185354.35310-1-rrangel@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sdhci_send_tuning uses mmc->ios.bus_width to determine the block size. Without this patch the block size would be set incorrectly when the bus_width == 8 which results in tuning failing. Signed-off-by: Raul E Rangel Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-pci-o2micro.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c index b29bf4e7dcb48..dd21315922c87 100644 --- a/drivers/mmc/host/sdhci-pci-o2micro.c +++ b/drivers/mmc/host/sdhci-pci-o2micro.c @@ -115,6 +115,7 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode) */ if (mmc->ios.bus_width == MMC_BUS_WIDTH_8) { current_bus_width = mmc->ios.bus_width; + mmc->ios.bus_width = MMC_BUS_WIDTH_4; sdhci_set_bus_width(host, MMC_BUS_WIDTH_4); } @@ -126,8 +127,10 @@ static int sdhci_o2_execute_tuning(struct mmc_host *mmc, u32 opcode) sdhci_end_tuning(host); - if (current_bus_width == MMC_BUS_WIDTH_8) + if (current_bus_width == MMC_BUS_WIDTH_8) { + mmc->ios.bus_width = MMC_BUS_WIDTH_8; sdhci_set_bus_width(host, current_bus_width); + } host->flags &= ~SDHCI_HS400_TUNING; return 0; From patchwork Mon Jun 10 18:53:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10985311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3CAD14B6 for ; Mon, 10 Jun 2019 18:55:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E21CA2876B for ; Mon, 10 Jun 2019 18:55:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4A8428770; Mon, 10 Jun 2019 18:55:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 740832876B for ; Mon, 10 Jun 2019 18:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388838AbfFJSzF (ORCPT ); Mon, 10 Jun 2019 14:55:05 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:35160 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388781AbfFJSzF (ORCPT ); Mon, 10 Jun 2019 14:55:05 -0400 Received: by mail-it1-f194.google.com with SMTP id n189so770429itd.0 for ; Mon, 10 Jun 2019 11:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cQMhD/I3Y/XjJlDvubFbz6WnQ+Gl+pIyjaq6A0eWHVw=; b=Emfxz6RY6w4czebKElQtlB10YASnT8iWdQGOGp5SE0x45AofJTF1UyNsWWCuBsQjW5 AaE90CsW7B+edHf6Hr5Ft6VbCu/bCscAC9k2L5NI+KrT/ipthSMMxbGdGy5FtDJnhzf9 LIc+nBiUlpKf7+hN8T5yZK+JOhAhURg8/Pa8Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cQMhD/I3Y/XjJlDvubFbz6WnQ+Gl+pIyjaq6A0eWHVw=; b=oKeXNcrs2VwhVjFZz5JM0EGuuG2WGKfwAUtsEVF7liSvfaW7w7EGdcr452vJkxA3U2 WP5zLnIT8gGy+QCkknEYaDKihOjqOntrLkHYpqxNHnP51kK4yGeoRo56M8PPJmdva55i JJk3cyzYFZ8X2huQ9+E+gQGM2E6d4+nHBO8CfruytTAj69+KT9j89evAK+24u0Y3F850 wdgrF0eidIP5d4ozxmCaxvoCQnt6MitBsL4Kth1DdFGu5u2rdNTnISS+N/nV49oWAhLQ XMqA4VzoI/VbvngRuiqnQa7l5ZjGd4UsUqZHe8wpjbSUj2cpVSHH2K/XsxauBMZMEoup rARg== X-Gm-Message-State: APjAAAVvVHWl9B7vP567R0nKLprvp7pqmn/e8cHQaJNMhPqeWnlGXbhW ANKe4wjWhfgd0TfqZ1ItYQUoInyy2y0= X-Google-Smtp-Source: APXvYqxJNfXV5i5V6uCmFvPs3vnRHn3+3uGvUWKJPHMZzmWz1MeUuxrppe7rrcjxVS3l3hqi0W8cDw== X-Received: by 2002:a24:7cd8:: with SMTP id a207mr14906744itd.68.1560192904769; Mon, 10 Jun 2019 11:55:04 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id r69sm175876itc.11.2019.06.10.11.55.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 11:55:04 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org Cc: ernest.zhang@bayhubtech.com, djkurtz@chromium.org, Raul E Rangel , linux-kernel@vger.kernel.org, Adrian Hunter , Ulf Hansson Subject: [PATCH 2/3] mmc: sdhci: sdhci-pci-o2micro: Check if controller supports 8-bit width Date: Mon, 10 Jun 2019 12:53:52 -0600 Message-Id: <20190610185354.35310-2-rrangel@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190610185354.35310-1-rrangel@chromium.org> References: <20190610185354.35310-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The O2 controller supports 8-bit EMMC access. mmc_select_bus_width() will be used to determine if the MMC supports 8-bit or 4-bit access. Signed-off-by: Raul E Rangel --- I tested this on an AMD chromebook. $ cat /sys/kernel/debug/mmc1/ios clock: 200000000 Hz actual clock: 200000000 Hz vdd: 21 (3.3 ~ 3.4 V) bus mode: 2 (push-pull) chip select: 0 (don't care) power mode: 2 (on) bus width: 3 (8 bits) timing spec: 9 (mmc HS200) signal voltage: 1 (1.80 V) driver type: 0 (driver type B) Before this patch only 4 bit was negotiated. drivers/mmc/host/sdhci-pci-o2micro.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c index dd21315922c87..07bb91cbdf1f8 100644 --- a/drivers/mmc/host/sdhci-pci-o2micro.c +++ b/drivers/mmc/host/sdhci-pci-o2micro.c @@ -395,11 +395,16 @@ int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot) { struct sdhci_pci_chip *chip; struct sdhci_host *host; - u32 reg; + u32 reg, caps; int ret; chip = slot->chip; host = slot->host; + + caps = sdhci_readl(host, SDHCI_CAPABILITIES); + if (caps & SDHCI_CAN_DO_8BIT) + host->mmc->caps |= MMC_CAP_8_BIT_DATA; + switch (chip->pdev->device) { case PCI_DEVICE_ID_O2_SDS0: case PCI_DEVICE_ID_O2_SEABIRD0: From patchwork Mon Jun 10 18:53:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 10985313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D4B41398 for ; Mon, 10 Jun 2019 18:55:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C94028759 for ; Mon, 10 Jun 2019 18:55:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30A482876E; Mon, 10 Jun 2019 18:55:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 577F328759 for ; Mon, 10 Jun 2019 18:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389000AbfFJSzK (ORCPT ); Mon, 10 Jun 2019 14:55:10 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:56058 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388765AbfFJSzK (ORCPT ); Mon, 10 Jun 2019 14:55:10 -0400 Received: by mail-it1-f195.google.com with SMTP id i21so757031ita.5 for ; Mon, 10 Jun 2019 11:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3OQiFS4mzZNpmchUtzhYv2GneN1IZGSv7wacJrf6EtE=; b=hNHkuWRDqlR3Q3TDaxHRzI06RqOjj75TOm4O2BEcyfY0AOdiydlwK2wHdT4xm6B8iT c2OTYhCNwn6/48JaeFcoPisRPJk2Ypw6FzF9hwTd17Lq9FURyXB6uxvutuGxuGi/aMDV bBmb3wHsiLbhCsSUfuqYYVT6vmhgQccim0vyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3OQiFS4mzZNpmchUtzhYv2GneN1IZGSv7wacJrf6EtE=; b=egunQ9wVW7zgwIGOYMyhicU2jgNxFp2FJj6mr5OyHlyE4XODonsYsEhawHLr/ga/bQ QgmexcXn4V++1wSAW3l/RprsuMOcqMMA/NAxeQcLa/jGdBGR+Sfzw8CIre86UCncUIb6 UCEQCq+GL7wusU1aF2LuJJAJiNYsZVKeDoeFxhWlnxWs7z7+QdjoSPLj2K2WYlVfbXA+ S4isZ+enikQ8GNFG2pErPsEPvjgRUAREvpxqnLU8KD04WCu1RK+m6aFhTqibUaWZcMVV aDpcPzVaFk6EncYgl7ChJ8QxxBYAbeHYaDe3StDMAEMwmdMTBFR4v21Lhaid2/kCUdkj Ektw== X-Gm-Message-State: APjAAAUdHZgF6Mp0wcGxLymRTDfdJO1g1fBawbrf6lJgFQ/p/tzZeLJy peOlzAilmF/p2kEUrbqC9G/gHYl6zBw= X-Google-Smtp-Source: APXvYqwKv/qZm4110xGTzg1+th2td34sNn7y93waDnRsw7ju3/C0X2SG909IBDR3rPJdGyr5tvxhSA== X-Received: by 2002:a24:1dd5:: with SMTP id 204mr16517482itj.180.1560192909650; Mon, 10 Jun 2019 11:55:09 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id d7sm3581954iob.67.2019.06.10.11.55.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 11:55:09 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org Cc: ernest.zhang@bayhubtech.com, djkurtz@chromium.org, Raul E Rangel , linux-kernel@vger.kernel.org, Adrian Hunter , Ulf Hansson Subject: [PATCH 3/3] mmc: sdhci: Fix indenting on SDHCI_CTRL_8BITBUS Date: Mon, 10 Jun 2019 12:53:53 -0600 Message-Id: <20190610185354.35310-3-rrangel@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog In-Reply-To: <20190610185354.35310-1-rrangel@chromium.org> References: <20190610185354.35310-1-rrangel@chromium.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The value is referring to SDHCI_HOST_CONTROL, not SDHCI_CTRL_DMA_MASK. Signed-off-by: Raul E Rangel Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 199712e7adbb3..89fd96596a1f7 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -89,7 +89,7 @@ #define SDHCI_CTRL_ADMA32 0x10 #define SDHCI_CTRL_ADMA64 0x18 #define SDHCI_CTRL_ADMA3 0x18 -#define SDHCI_CTRL_8BITBUS 0x20 +#define SDHCI_CTRL_8BITBUS 0x20 #define SDHCI_CTRL_CDTEST_INS 0x40 #define SDHCI_CTRL_CDTEST_EN 0x80