From patchwork Mon Jun 17 20:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 11000379 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 1522E1398 for ; Mon, 17 Jun 2019 20:10:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F307F2882F for ; Mon, 17 Jun 2019 20:10:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E73822888A; Mon, 17 Jun 2019 20:10:22 +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 8469828856 for ; Mon, 17 Jun 2019 20:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728602AbfFQUKV (ORCPT ); Mon, 17 Jun 2019 16:10:21 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:37593 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728518AbfFQUKV (ORCPT ); Mon, 17 Jun 2019 16:10:21 -0400 Received: by mail-io1-f65.google.com with SMTP id e5so24217313iok.4 for ; Mon, 17 Jun 2019 13:10:20 -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=Zhz2d9XJe8nX7yclD2KabSz2ABSlxKrOqshNsQUbLNs=; b=Y6+XH3rTuBpT3/+zGSEve8N2Cd4liXJXGlvGeJlSlgjF4gvKqhNYNQxq4gH2UmWvyX JRm4nzTjgugm66g7l1Ku3kx7AtyeUDOjqK0/t+VGLauGNDrRYHMgRW4cdQWrRGcBinuJ IJ2ILz0XYXRMpBMaqMofa8CyfHQqrj4BGtpAU= 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=Zhz2d9XJe8nX7yclD2KabSz2ABSlxKrOqshNsQUbLNs=; b=UOWLaPcOR2XhGQnElyJynId7A5ufG/j7FC9LNWVd2gu7w0nMt1wAYW/BDx7UBnK1xH HCwnOI7UqZmkAIIvbz6XBv1ToGndFxRAQM6pNsjaKvtrtOG2uL651/TD3LA4guSIh5JH RLftPn6HQRUeYZ5f+x0GoSLVi/x+7xmXLNWQw0wCYWQohgDGvpHPxg+/9fQyc0xOkutQ 1/k7nvPevYCMZbnWMsvAtiFO5gyW4vAkDf5JImBOjLnwLyGUCI5zN2hPPfNsGN3z4mt6 229+s4tFkSTrYBmCWoLe+jVvQdVu2Hyjrf8f2/SeJKnAsaNMj+2GPc528PN8SxjDOmfR KpQg== X-Gm-Message-State: APjAAAWihHUZc4CtqaOt5hXrNK7Ioo19lBOe6gh5hsgmYIQ0pWut7cUf ZIi2P76HdW9men4VH+Ng6YkVPc/Yb+o= X-Google-Smtp-Source: APXvYqyvSFVPICXlZ5qOrdYqNCjoeODwgIZegCYh7Y1Z/RNaw1BomNUYMBee5d7BAhV7K2HU9ro+EQ== X-Received: by 2002:a5d:9643:: with SMTP id d3mr18399719ios.227.1560802220123; Mon, 17 Jun 2019 13:10:20 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id b6sm9755978iok.71.2019.06.17.13.10.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 13:10:19 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org Cc: ernest.zhang@bayhubtech.com, djkurtz@chromium.org, Raul E Rangel , Adrian Hunter , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 1/3] mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning Date: Mon, 17 Jun 2019 14:10:12 -0600 Message-Id: <20190617201014.84503-1-rrangel@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-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 The O2Micro controller only supports tuning at 4-bits. So the host driver needs to change the bus width while tuning and then set it back when done. There was a bug in the original implementation in that mmc->ios.bus_width also wasn't updated. Thus setting the incorrect blocksize in sdhci_send_tuning which results in a tuning failure. Signed-off-by: Raul E Rangel Fixes: 0086fc217d5d7 ("mmc: sdhci: Add support for O2 hardware tuning") 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 17 20:10:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 11000381 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 246D51398 for ; Mon, 17 Jun 2019 20:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18B8128607 for ; Mon, 17 Jun 2019 20:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D4B3288FA; Mon, 17 Jun 2019 20:10:27 +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 AE0F528607 for ; Mon, 17 Jun 2019 20:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729001AbfFQUKZ (ORCPT ); Mon, 17 Jun 2019 16:10:25 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:46842 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728943AbfFQUKX (ORCPT ); Mon, 17 Jun 2019 16:10:23 -0400 Received: by mail-io1-f67.google.com with SMTP id i10so24031930iol.13 for ; Mon, 17 Jun 2019 13:10:23 -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=TrP+dwORO9Xg4aec0HaWAympb2e/AJiy4gVQT0weYII=; b=Tt1rc+ZS5s3ESXw6Ayk3cPGD+JH2l1u+D6wOwC5cLjeRxfOgt3UjNysh5Us5d6LYYe XlJsJRNBimN64BpEFyyZLbCFstqRfDhXhIXa9gQHIR54lo/sfhzrEfhDfaxZjmjcNQDO OCC2H/nYzkpPawyo5nqdZza510JsZElQZDl9o= 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=TrP+dwORO9Xg4aec0HaWAympb2e/AJiy4gVQT0weYII=; b=sEVrpLnMSEFvNRD2wlWOLpkors5J+qagN64uXhfub2wauU/4q9mS9jfKktGRxaPNBg EttlogOgRz59uWZd8wAMw3v+DYkZJQLGohvcwk4t4FdUbBiXORMeTVS/L1/HKy7rU0VZ jytNnv78pC4JQpTj1U9BrOX2GJUeGiq3f9p1FxbgJKmbW+/dirEcuA7/wjXuKdHeZiaM 4GjwFfnREz9tUUz3qjsabGp3AM+sv3lrmt3FUZ4rvZgw+OUGUvYAtKQsvEgiehB4lpcc NP8KnvUNLy+e3aqZ1S2DQ2qSflK/A9sK1JXemI23KKs1eT6ZqFf85UUtvTdjaeP1lC+L tBOg== X-Gm-Message-State: APjAAAUBPOcqMJQXbyI2h8z8ESpDCnuCeukLTvkugVBM23PxuvKVBaYs mUEdlDmOIpv/oT7ldJMkFCgmqc8/TJo= X-Google-Smtp-Source: APXvYqygMJgeWzK1ojHPxZex1M+4XMd9/xaXnVY9vsSh+ib4eptOyhNbzhCuBUjV952+Zzqj8lC6DA== X-Received: by 2002:a05:6602:2183:: with SMTP id b3mr694917iob.249.1560802222714; Mon, 17 Jun 2019 13:10:22 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id e26sm11047672iod.10.2019.06.17.13.10.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 13:10:22 -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 v2 2/3] mmc: sdhci: sdhci-pci-o2micro: Check if controller supports 8-bit width Date: Mon, 17 Jun 2019 14:10:13 -0600 Message-Id: <20190617201014.84503-2-rrangel@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201014.84503-1-rrangel@chromium.org> References: <20190617201014.84503-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. JESD84-B51 section A.6.3.a defines the bus testing procedure that `mmc_select_bus_width()` implements. This is used to determine the actual bus width of the eMMC. Signed-off-by: Raul E Rangel Acked-by: Adrian Hunter --- 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c b/drivers/mmc/host/sdhci-pci-o2micro.c index dd21315922c87..9dc4548271b4b 100644 --- a/drivers/mmc/host/sdhci-pci-o2micro.c +++ b/drivers/mmc/host/sdhci-pci-o2micro.c @@ -395,11 +395,21 @@ 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); + + /* + * mmc_select_bus_width() will test the bus to determine the actual bus + * width. + */ + 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 17 20:10:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raul Rangel X-Patchwork-Id: 11000383 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 9443F1398 for ; Mon, 17 Jun 2019 20:10:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87CBE2882F for ; Mon, 17 Jun 2019 20:10:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AA97288F4; Mon, 17 Jun 2019 20:10:30 +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 1947F2882F for ; Mon, 17 Jun 2019 20:10:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728621AbfFQUK2 (ORCPT ); Mon, 17 Jun 2019 16:10:28 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:34492 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728976AbfFQUKZ (ORCPT ); Mon, 17 Jun 2019 16:10:25 -0400 Received: by mail-io1-f65.google.com with SMTP id k8so24267506iot.1 for ; Mon, 17 Jun 2019 13:10:25 -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=GmQHqjhHBWJi9EwLf/CG1WJEE+QuCC5/BPgepbsr0cM=; b=H/fRfIgOLxZAjL30Tf02SNyuVL4rKUnrX2bKgFBJyd5IQUZx1ZP6q7691JqcjyC9nS ++sCnwMqLy/QpEj+7Hi7jU5SjniVAjL78+/q92CgC7hs/S7yVAkyhXYXlfSH69K6ZbzC a5AjFLd56W7UgJEv9EIhkxSJcgspEV81Jgn30= 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=GmQHqjhHBWJi9EwLf/CG1WJEE+QuCC5/BPgepbsr0cM=; b=SpjO9ZLZJoGIo/MDvgkfew7jZ8QSwp358p3SsADifnPQxwOkIMul52BN+bjijaYYlv LXy8E1hR5iBxLDANG9MkCWME2N319duf6sabjR4tWn+1ozJnqlv6hHO87+B/1bOgiMqB I2/M7m7zlrZRNgRI1oG2xsDU+Zn20WGJNkD8NO9gY/fzH5UWzb0+CIUqPOsCaw7NghYy ppRXIuTcIOje0fstRhhdnyCIU1rjrbljtQHfTTlFxF0xIkZDGlclHN4H+RTLn3oO6eu7 dlzrHpEZbdr9A1rWevT8EkJqir6I+wPu4RiP9aejDCyI/eA/TzqehbRwBwHDdpuIBIgI HGiA== X-Gm-Message-State: APjAAAWnGUuyGDwQ8K+EHwKGlb9yp0SHN4kF5UkCa+cxwQSq3aEXZ1zy l9F8sStWbHGdJulpYMNggX3Q3+i8r6U= X-Google-Smtp-Source: APXvYqwODDA3bqD50Y83iVab01joUoo1S7LoKNsRIrKC1JdP7WoFgOUSHbQOduVooAcoh4huWj9+dg== X-Received: by 2002:a6b:b257:: with SMTP id b84mr63639506iof.137.1560802224611; Mon, 17 Jun 2019 13:10:24 -0700 (PDT) Received: from localhost ([2620:15c:183:0:20b8:dee7:5447:d05]) by smtp.gmail.com with ESMTPSA id s6sm9199236ioo.31.2019.06.17.13.10.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 13:10:24 -0700 (PDT) From: Raul E Rangel To: linux-mmc@vger.kernel.org Cc: ernest.zhang@bayhubtech.com, djkurtz@chromium.org, Raul E Rangel , Adrian Hunter , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 3/3] mmc: sdhci: Fix indenting on SDHCI_CTRL_8BITBUS Date: Mon, 17 Jun 2019 14:10:14 -0600 Message-Id: <20190617201014.84503-3-rrangel@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201014.84503-1-rrangel@chromium.org> References: <20190617201014.84503-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 Remove whitespace in front of SDHCI_CTRL_8BITBUS. The value is not part of 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