public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Balaji T K <balajitk@ti.com>
Cc: chris@printf.net, ulf.hansson@linaro.org,
	linux-mmc@vger.kernel.org,
	Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Felipe Balbi <balbi@ti.com>
Subject: [PATCH 2/5] mmc: host: omap_hsmmc: add reg_offset field
Date: Wed, 26 Mar 2014 19:04:47 -0500	[thread overview]
Message-ID: <1395878690-9650-3-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1395878690-9650-1-git-send-email-balbi@ti.com>

by saving reg_offset inside our host structure
we can ioremap the correct area, make use of
resource_size() and make sure newer versions
of the IP have access to the new set of registers
which were added back in OMAP4.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index a8f1e08..d46f768 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -152,10 +152,10 @@
  * MMC Host controller read/write API's
  */
 #define OMAP_HSMMC_READ(host, reg)	\
-	__raw_readl((host)->base + OMAP_HSMMC_##reg)
+	__raw_readl((host)->base + OMAP_HSMMC_##reg + host->reg_offset)
 
 #define OMAP_HSMMC_WRITE(host, reg, val) \
-	__raw_writel((val), (host)->base + OMAP_HSMMC_##reg)
+	__raw_writel((val), (host)->base + OMAP_HSMMC_##reg + host->reg_offset)
 
 struct omap_hsmmc_next {
 	unsigned int	dma_len;
@@ -184,6 +184,7 @@ struct omap_hsmmc_host {
 	void	__iomem		*base;
 	resource_size_t		mapbase;
 	spinlock_t		irq_lock; /* Prevent races with irq handler */
+	unsigned int		reg_offset;
 	unsigned int		dma_len;
 	unsigned int		dma_sg_idx;
 	unsigned char		bus_mode;
@@ -1354,8 +1355,8 @@ static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host,
 
 	chan = omap_hsmmc_get_dma_chan(host, data);
 
-	cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA;
-	cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA;
+	cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA + host->reg_offset;
+	cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA + host->reg_offset;
 	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 	cfg.src_maxburst = data->blksz / 4;
@@ -1903,8 +1904,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	host->dma_ch	= -1;
 	host->irq	= irq;
 	host->slot_id	= 0;
-	host->mapbase	= res->start + pdata->reg_offset;
-	host->base	= ioremap(host->mapbase, SZ_4K);
+	host->reg_offset = pdata->reg_offset;
+	host->mapbase	= res->start;
+	host->base	= ioremap(res->start, resource_size(res));
 	host->power_mode = MMC_POWER_OFF;
 	host->next_data.cookie = 1;
 	host->pbias_enabled = 0;
-- 
1.9.1.286.g5172cb3

  parent reply	other threads:[~2014-03-27  0:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  0:04 [PATCH 0/5] mmc: host: omap_hsmmc: a few improvements Felipe Balbi
2014-03-27  0:04 ` [PATCH 1/5] mmc: host: omap_hsmmc: pass host as an argument Felipe Balbi
2014-03-27  0:04 ` Felipe Balbi [this message]
2014-03-27  0:04 ` [PATCH 3/5] mmc: host: omap_hsmmc: introduce new accessor functions Felipe Balbi
2014-04-24 15:17   ` Balaji T K
2014-03-27  0:04 ` [PATCH 4/5] mmc: host: omap_hsmmc: switch over to new accessors Felipe Balbi
2014-03-27  0:04 ` [PATCH 5/5] mmc: host: omap_hsmmc: set max_blk_size correctly Felipe Balbi
2014-03-27  0:12   ` Felipe Balbi
2014-04-21 17:32 ` [PATCH 0/5] mmc: host: omap_hsmmc: a few improvements Felipe Balbi
2014-04-22 15:30   ` Balaji T K
2014-04-22 15:48     ` Felipe Balbi
2014-04-23 16:26       ` Felipe Balbi
2014-04-24 15:21       ` Balaji T K
2014-04-24 15:26         ` Felipe Balbi
2014-04-24 14:31 ` Balaji T K
2014-04-24 14:39   ` Felipe Balbi
2014-04-24 14:43     ` Balaji T K
2014-04-24 14:48       ` Felipe Balbi

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=1395878690-9650-3-git-send-email-balbi@ti.com \
    --to=balbi@ti.com \
    --cc=balajitk@ti.com \
    --cc=chris@printf.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ulf.hansson@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