From patchwork Fri Jun 15 02:04:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 10465579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1F84600F4 for ; Fri, 15 Jun 2018 02:06:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B053028CD7 for ; Fri, 15 Jun 2018 02:06:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A52F628CDB; Fri, 15 Jun 2018 02:06:05 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 49D5628CD7 for ; Fri, 15 Jun 2018 02:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965469AbeFOCFL (ORCPT ); Thu, 14 Jun 2018 22:05:11 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:35984 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965457AbeFOCFI (ORCPT ); Thu, 14 Jun 2018 22:05:08 -0400 Received: by mail-pl0-f65.google.com with SMTP id a7-v6so4535975plp.3 for ; Thu, 14 Jun 2018 19:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2kKdK2qZqm7YxqxQreraVLLw0s8TN4UgsB3k/YpdPQI=; b=X42FyhXCSenAv4Ga0WliOss8Cl4vi1DAOFgbG7LsvEkAlK+cozcgvYSxeKDBsForin n/y8/QlrCYewK5IuFj+O1Cq0LtADv76oEypKgWDIi6R1+WiSf2WPenAvItnsQ/Gpqweg m0nCrcwHPSKyp7nwaNgHYIfjmTmpw0qmJdoto= 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; bh=2kKdK2qZqm7YxqxQreraVLLw0s8TN4UgsB3k/YpdPQI=; b=GTflH19CrQ/hB9Jse8BJS/pTc9CfMGRU+vFnLPS1zDfdt+nOaKLYlzxZwMBh8JLcjt 6P6KBN98JjJuDwJXNiquBzegB/R8l20JUSQ2x5nUAMiW8EcpkNnr63xo74/TaALLhNK6 GJc4nqQmgj4OdFR07+f8EQy/sIJbqHSH5Wip/JYAAv1rO8gl5C45Wh4nTeJLIfalpt2p /Dwr7KBWlqZ7ykzwiYdPWJYZZB/W2MiiziKOea1q+DenT0ijYgF1cMy8TIgmNzyR1hpE U+j2LTIEiq/PVYp01HEHX7oPIwKkahnB5NIuJAMOVN5VDxM/f6tj9f8cJDlh5zUcKpGH hhSA== X-Gm-Message-State: APt69E0Z6iiB4TARFHnUPxzR9jpOJw719n45PD4o8MP+6fb0JW+W04QV iKL9opWTN5zH9Z39+LBzPpzbFw== X-Google-Smtp-Source: ADUXVKJQyXkd9ju5H3livOuUXi7QaxgJkMijK+Zp+vLdPBu9BYexJrSotcOqVnuqSiuFQoL+SMx+Tg== X-Received: by 2002:a17:902:8206:: with SMTP id x6-v6mr5621199pln.220.1529028308184; Thu, 14 Jun 2018 19:05:08 -0700 (PDT) Received: from ubt.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id k69-v6sm9504953pgc.39.2018.06.14.19.05.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Jun 2018 19:05:07 -0700 (PDT) From: Chunyan Zhang To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Orson Zhai , Baolin Wang , Billows Wu , zhang.lyra@gmail.com Subject: [PATCH V2 4/7] mmc: sdhci: add 32-bit block count support for v4 mode Date: Fri, 15 Jun 2018 10:04:12 +0800 Message-Id: <1529028255-6022-5-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> References: <1529028255-6022-1-git-send-email-zhang.chunyan@linaro.org> 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 When Host Version 4 is enabled, SDMA System Address register is re-defined as 32-bit Block Count, and SDMA uses ADMA System Address register (05Fh-058h) instead. Signed-off-by: Chunyan Zhang --- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 5d3b0d8..b8ee124 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -943,7 +943,8 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) /* Set the DMA boundary value and block size */ sdhci_writew(host, SDHCI_MAKE_BLKSZ(host->sdma_boundary, data->blksz), SDHCI_BLOCK_SIZE); - sdhci_writew(host, data->blocks, SDHCI_BLOCK_COUNT); + reg = host->v4_mode ? SDHCI_32BIT_BLK_CNT : SDHCI_BLOCK_COUNT; + sdhci_writew(host, data->blocks, reg); } static inline bool sdhci_auto_cmd12(struct sdhci_host *host, diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 820a863..1e84539 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -28,6 +28,7 @@ #define SDHCI_DMA_ADDRESS 0x00 #define SDHCI_ARGUMENT2 SDHCI_DMA_ADDRESS +#define SDHCI_32BIT_BLK_CNT SDHCI_DMA_ADDRESS #define SDHCI_BLOCK_SIZE 0x04 #define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF))