From patchwork Thu Mar 27 00:04:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 3895911 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A4D7BF540 for ; Thu, 27 Mar 2014 00:09:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F52220170 for ; Thu, 27 Mar 2014 00:09:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BD8820166 for ; Thu, 27 Mar 2014 00:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755743AbaC0AIy (ORCPT ); Wed, 26 Mar 2014 20:08:54 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:55017 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756632AbaC0AGz (ORCPT ); Wed, 26 Mar 2014 20:06:55 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2R06kOR028573; Wed, 26 Mar 2014 19:06:46 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2R06kjD012385; Wed, 26 Mar 2014 19:06:46 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 26 Mar 2014 19:06:46 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2R06jre029646; Wed, 26 Mar 2014 19:06:46 -0500 From: Felipe Balbi To: Balaji T K CC: , , , Linux OMAP Mailing List , Linux Kernel Mailing List , Felipe Balbi Subject: [PATCH 2/5] mmc: host: omap_hsmmc: add reg_offset field Date: Wed, 26 Mar 2014 19:04:47 -0500 Message-ID: <1395878690-9650-3-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.1.286.g5172cb3 In-Reply-To: <1395878690-9650-1-git-send-email-balbi@ti.com> References: <1395878690-9650-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;