From: Shawn Lin <shawn.lin@rock-chips.com>
To: jh80.chung@samsung.com, ulf.hansson@linaro.org
Cc: Vineet.Gupta1@synopsys.com, Wei Xu <xuwei5@hisilicon.com>,
Joachim Eastwood <manabian@gmail.com>,
Alexey Brodkin <abrodkin@synopsys.com>,
Kukjin Kim <kgene@kernel.org>,
Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Russell King <linux@arm.linux.org.uk>,
Zhangfei Gao <zhangfei.gao@linaro.org>,
Jun Nie <jun.nie@linaro.org>, Ralf Baechle <ralf@linux-mips.org>,
Govindraj Raja <govindraj.raja@imgtec.com>,
Arnd Bergmann <arnd@arndb.de>,
heiko@sntech.de, dianders@chromium.org,
linux-samsung-soc@vger.kernel.org, linux-mips@linux-mips.org,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Shawn Lin <shawn.lin@rock-chips.com>
Subject: [RFC PATCH v7 02/10] mmc: dw_mmc: use macro for HCON register operations
Date: Mon, 24 Aug 2015 09:25:54 +0800 [thread overview]
Message-ID: <1440379554-24444-1-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1440379479-24308-1-git-send-email-shawn.lin@rock-chips.com>
This patch add some macros for HCON register operations
to make code more readable.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
drivers/mmc/host/dw_mmc.c | 6 +++---
drivers/mmc/host/dw_mmc.h | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 9c91983..0a3c63c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2678,7 +2678,7 @@ static void dw_mci_init_dma(struct dw_mci *host)
* Check ADDR_CONFIG bit in HCON to find
* IDMAC address bus width
*/
- addr_config = (mci_readl(host, HCON) >> 27) & 0x01;
+ addr_config = SDMMC_GET_ADDR_CONFIG(mci_readl(host, HCON));
if (addr_config == 1) {
/* host supports IDMAC in 64-bit address mode */
@@ -3060,7 +3060,7 @@ int dw_mci_probe(struct dw_mci *host)
* Get the host data width - this assumes that HCON has been set with
* the correct values.
*/
- i = (mci_readl(host, HCON) >> 7) & 0x7;
+ i = SDMMC_GET_HDATA_WIDTH(mci_readl(host, HCON));
if (!i) {
host->push_data = dw_mci_push_data16;
host->pull_data = dw_mci_pull_data16;
@@ -3142,7 +3142,7 @@ int dw_mci_probe(struct dw_mci *host)
if (host->pdata->num_slots)
host->num_slots = host->pdata->num_slots;
else
- host->num_slots = ((mci_readl(host, HCON) >> 1) & 0x1F) + 1;
+ host->num_slots = SDMMC_GET_SLOT_NUM(mci_readl(host, HCON));
/*
* Enable interrupts for command done, data over, data empty,
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 811d467..f2a88d4 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -154,6 +154,9 @@
#define DMA_INTERFACE_GDMA (0x2)
#define DMA_INTERFACE_NODMA (0x3)
#define SDMMC_GET_TRANS_MODE(x) (((x)>>16) & 0x3)
+#define SDMMC_GET_SLOT_NUM(x) ((((x)>>1) & 0x1F) + 1)
+#define SDMMC_GET_HDATA_WIDTH(x) (((x)>>7) & 0x7)
+#define SDMMC_GET_ADDR_CONFIG(x) (((x)>>27) & 0x1)
/* Internal DMAC interrupt defines */
#define SDMMC_IDMAC_INT_AI BIT(9)
#define SDMMC_IDMAC_INT_NI BIT(8)
--
2.3.7
next prev parent reply other threads:[~2015-08-24 1:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 1:24 [RFC PATCH v7 0/10] Add external dma support for Synopsys MSHC Shawn Lin
2015-08-24 1:25 ` [RFC PATCH v7 01/10] mmc: dw_mmc: Add external dma interface support Shawn Lin
2015-09-15 8:08 ` Jaehoon Chung
2015-09-15 8:52 ` Shawn Lin
2015-08-24 1:25 ` Shawn Lin [this message]
2015-09-15 8:10 ` [RFC PATCH v7 02/10] mmc: dw_mmc: use macro for HCON register operations Jaehoon Chung
2015-08-24 1:26 ` [RFC PATCH v7 03/10] Documentation: synopsys-dw-mshc: add bindings for idmac and edmac Shawn Lin
2015-08-24 1:26 ` [RFC PATCH v7 04/10] mips: pistachio_defconfig: remove CONFIG_MMC_DW_IDMAC Shawn Lin
2015-08-24 1:26 ` [RFC PATCH v7 05/10] arc: axs10x_defconfig: " Shawn Lin
2015-08-24 1:27 ` [RFC PATCH v7 06/10] arm: exynos_defconfig: " Shawn Lin
2015-08-24 1:27 ` [RFC PATCH v7 07/10] arm: hisi_defconfig: " Shawn Lin
2015-08-24 1:27 ` [RFC PATCH v7 08/10] arm: lpc18xx_defconfig: " Shawn Lin
2015-08-24 1:27 ` [RFC PATCH v7 09/10] arm: multi_v7_defconfig: " Shawn Lin
2015-08-24 1:28 ` [RFC PATCH v7 10/10] arm: zx_defconfig: " Shawn Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440379554-24444-1-git-send-email-shawn.lin@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=abrodkin@synopsys.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=govindraj.raja@imgtec.com \
--cc=heiko@sntech.de \
--cc=jh80.chung@samsung.com \
--cc=jun.nie@linaro.org \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=manabian@gmail.com \
--cc=ralf@linux-mips.org \
--cc=ulf.hansson@linaro.org \
--cc=xuwei5@hisilicon.com \
--cc=zhangfei.gao@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).