From patchwork Fri May 30 16:20:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 31200 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C129A20068 for ; Fri, 30 May 2014 16:21:04 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id db11sf9494708veb.0 for ; Fri, 30 May 2014 09:21:04 -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:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=EC0pWeemwqj7PGnfWYXpJCGiS52V1bWN6OYd1uI5ZqE=; b=iBYObYrqxFGEJAwAxpR0LsNmsk49wymr0tG9FGna2KbnfkMcc4qfpHlDNj1giktv8G CW4ASra/ew3H43FCeM4lPpbQxnrkFh5LVhXCbjRstyRsiyENekt4K/R6ZGi5fXicjV4g X+Frpg0m8qiMbO8/kZ5sJPezTsWDuNiK4RLAGgJzfAjJR7HQAESrKRu75sE34dd2WHcn li0lvTm5uCTQSQFWXxPCdU+0YWsxB06MDiLI1sOe+H1KfLbjs4+uheAelIPwB1hbOsSF Se6wDHV9uJQ8/SyeEpYAuwndvqJplcLsYq4Wn05/Mq8ri5eJbKuNThilrmzisxpIkTO0 aSQA== X-Gm-Message-State: ALoCoQlTAXeaCQs2Co+6m0tPAx9+XzLKC1MwhaYjeRstUAFHZ3QUWtaQC4nfY3bpgxMYGiFlaY8b X-Received: by 10.224.90.2 with SMTP id g2mr5880675qam.1.1401466864467; Fri, 30 May 2014 09:21:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.115 with SMTP id c106ls1123890qge.55.gmail; Fri, 30 May 2014 09:21:04 -0700 (PDT) X-Received: by 10.221.44.73 with SMTP id uf9mr14918798vcb.9.1401466864226; Fri, 30 May 2014 09:21:04 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id n9si3454990vdw.16.2014.05.30.09.21.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 May 2014 09:21:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ik5so2150099vcb.19 for ; Fri, 30 May 2014 09:21:04 -0700 (PDT) X-Received: by 10.58.2.74 with SMTP id 10mr2325392ves.61.1401466864115; Fri, 30 May 2014 09:21:04 -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.221.72 with SMTP id ib8csp124662vcb; Fri, 30 May 2014 09:21:02 -0700 (PDT) X-Received: by 10.68.110.3 with SMTP id hw3mr1125952pbb.144.1401466860502; Fri, 30 May 2014 09:21:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rw8si6238726pab.167.2014.05.30.09.21.00; Fri, 30 May 2014 09:21:00 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933709AbaE3QU7 (ORCPT + 3 others); Fri, 30 May 2014 12:20:59 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:57167 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932378AbaE3QU6 (ORCPT ); Fri, 30 May 2014 12:20:58 -0400 Received: by mail-we0-f169.google.com with SMTP id u56so2301292wes.0 for ; Fri, 30 May 2014 09:20:56 -0700 (PDT) X-Received: by 10.194.82.170 with SMTP id j10mr23567926wjy.63.1401466854474; Fri, 30 May 2014 09:20:54 -0700 (PDT) Received: from [192.168.1.101] (host-78-149-4-211.as13285.net. [78.149.4.211]) by mx.google.com with ESMTPSA id ds9sm4341425wib.20.2014.05.30.09.20.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 May 2014 09:20:53 -0700 (PDT) Message-ID: <5388AFE3.4@linaro.org> Date: Fri, 30 May 2014 17:20:51 +0100 From: Srinivas Kandagatla User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Ulf Hansson CC: Russell King , linux-mmc , Chris Ball , "linux-kernel@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , Linus Walleij Subject: Re: [PATCH v4 13/13] mmc: mmci: Add Qcom specific pio_read function. References: <1401284608-16428-1-git-send-email-srinivas.kandagatla@linaro.org> <1401284886-16978-1-git-send-email-srinivas.kandagatla@linaro.org> <53886F25.8060509@linaro.org> In-Reply-To: <53886F25.8060509@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) 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: , Hi Ulf, Managed to reuse the existing mmci_pio_read function with some minor modifications, Issue was with reading full fifo sizes which was creating the issue. On 30/05/14 12:44, Srinivas Kandagatla wrote: > That sounds sensible.. I will try it. >> >>> + *ptr = readl(host->base + MMCIFIFO + (count % >>> fsize)); >> >> This looks strange. :-) Depending on the count you will read an offset >> into the FIFO? Seems like a very awkward implementation of a FIFO in >> the HW. :-) >> > I got into weird issues when I tried using the mmci_pio_read, the fifo > implementation seems to be different. I dont have full details on the > fifo behaviour. > > Most of this logic is inherited from 3.4 qcom andriod kernel. > >> BTW, what does "MCI_RXDATAAVLBL" actually mean for the Qcom variant? > > It means, At least 1 word in the RX FIFO. SW can read 1 word only from > the FIFO. > >> How much data could you expect in the FIFO when this status is >> triggered? > >> Are there no option of reading a number of words, depending on what >> type FIFO IRQ that was raised? > There are RXFIFO_HALF_FULL and RXFIFO_FULL bits in status register, but > I never tried to use them. Might be worth a try before I send next > version patches. > the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -73,6 +73,7 @@ static unsigned int fmax = 515633; * @busy_detect: true if busy detection on dat0 is supported * @pwrreg_nopower: bits in MMCIPOWER don't controls ext. power supply * @explicit_mclk_control: enable explicit mclk control in driver. + * @qcom_fifo: enables qcom specific fifo pio read logic. */ struct variant_data { unsigned int clkreg; @@ -95,6 +96,7 @@ struct variant_data { bool busy_detect; bool pwrreg_nopower; bool explicit_mclk_control; + bool qcom_fifo; }; static struct variant_data variant_arm = { @@ -990,15 +992,33 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, } } +static int mmci_get_rx_fifocnt(struct mmci_host *host, u32 status, int remain) +{ + return remain - (readl(host->base + MMCIFIFOCNT) << 2); +} + +static int mmci_qcom_get_rx_fifocnt(struct mmci_host *host, u32 status, int r) +{ + /* + * on qcom SDCC4 only 8 words are used in each burst so only 8 addresses + * from the fifo range should be used + */ + if (status & MCI_RXFIFOHALFFULL) + return host->variant->fifohalfsize; + else + return 4; +} + static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int remain) { void __iomem *base = host->base; char *ptr = buffer; - u32 status; + int hf = host->variant->fifohalfsize; int host_remain = host->size; + u32 status = readl(host->base + MMCISTATUS); do { - int count = host_remain - (readl(base + MMCIFIFOCNT) << 2); + int count = host->get_rx_fifocnt(host, status, host_remain); if (count > remain) count = remain; @@ -1488,6 +1508,11 @@ static int mmci_probe(struct amba_device *dev, if (ret) goto host_free; + if (variant->qcom_fifo) + host->get_rx_fifocnt = mmci_qcom_get_rx_fifocnt; + else + host->get_rx_fifocnt = mmci_get_rx_fifocnt; + host->plat = plat; host->variant = variant; host->mclk = clk_get_rate(host->clk); diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index b5f0810..5f76670 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -229,6 +229,7 @@ struct mmci_host { /* pio stuff */ struct sg_mapping_iter sg_miter; unsigned int size; + int (*get_rx_fifocnt)(struct mmci_host *h, u32 status, int remain); #ifdef CONFIG_DMA_ENGINE -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in