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: 27166 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 179A520369 for ; Thu, 27 Mar 2014 00:09:28 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id x10sf6112560pdj.10 for ; Wed, 26 Mar 2014 17:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=3aqL/hZRvFFwIKoP3zpNgMLAGjeXv/Ria+qTeirHfFg=; b=EFeoJ2Tu3hvHRu4tTlFFEwk5s3jt+ghoQmfddZJC4OPZ3QwMUM2RJtaCbH7eskg8Pf TCg6J51YqyAHDF0BTwaNGg0asUDGKfpcTxKz0XfQGyNTOvIIzZ0QHzt0s3Q5lfLM5Uz2 1/8837deM/ZRjI7K0GsrBKSre/g5FMnyUKRFuwVRGHqv6uqPSqpHBbRPCXyGvDSggMae RPt751qmKNWSdo6NnpJ+rZ0w/j6kplGr6O002+GVxl/7Yg6VuAhQRuW4Y0hOiioCh/lp /K21a1OqWpfynIjxcw3ibCOG7KTSWfoRSIIa821eTdxMX/bbM6bf6dha39TQV2ftdybB fAXA== X-Gm-Message-State: ALoCoQluVKvOImWV5ZN6hPZFyorTmsyM1mys7+1Ily4LkhWZJ2mIKXFVYJELmN9RqB711DBU6iRV X-Received: by 10.66.189.163 with SMTP id gj3mr2825849pac.32.1395878968333; Wed, 26 Mar 2014 17:09:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.196 with SMTP id 62ls811934qgt.76.gmail; Wed, 26 Mar 2014 17:09:28 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr3901863vcb.24.1395878968225; Wed, 26 Mar 2014 17:09:28 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id gq1si67225vec.131.2014.03.26.17.09.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 17:09:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so3176562veb.39 for ; Wed, 26 Mar 2014 17:09:28 -0700 (PDT) X-Received: by 10.52.34.4 with SMTP id v4mr43038vdi.42.1395878968142; Wed, 26 Mar 2014 17:09:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp86008vck; Wed, 26 Mar 2014 17:09:27 -0700 (PDT) X-Received: by 10.68.193.166 with SMTP id hp6mr21901708pbc.144.1395878967283; Wed, 26 Mar 2014 17:09:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si136622pbq.190.2014.03.26.17.09.26; Wed, 26 Mar 2014 17:09:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756537AbaC0AIz (ORCPT + 26 others); Wed, 26 Mar 2014 20:08:55 -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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;