From patchwork Mon Jan 7 11:21:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 13871 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2A6F823EC8 for ; Mon, 7 Jan 2013 11:24:32 +0000 (UTC) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by fiordland.canonical.com (Postfix) with ESMTP id A2E39A19344 for ; Mon, 7 Jan 2013 11:24:31 +0000 (UTC) Received: by mail-vb0-f53.google.com with SMTP id b23so19252330vbz.12 for ; Mon, 07 Jan 2013 03:24:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=SkUB+p8XU34/7md2VQzuxff198neVFX27rfk9RMGZTE=; b=ax+gxENcqB1mTHM9JoHdZsxtMBkl+RqMZwRBscVx1Qbg84EoM7YSwFkjiCAjMfdfar 34u9d+RpR+7LLZRBbopRa3hUMaWdveUdsME66+v2K3yG6eXFQ/RZzySJ15eb6bioqUnC vnhwZSI0tHJSt4bNGuEGo3pSGDxHAu3L49/556CPRp+h+J6Bu43eFE3GhDvVDu+RFzu8 /rwuVssW84NwNOC4h3MdvW+HC8szgBIjQDmlf/fiBZ6Oo8ckkwCvfcYbH3kdsHOREZEL NZMveTa2KtAkVDfl+gUX2a1yg2bl2uRRO588MC6PzFqq1mufjLfznaY/18Jy536AeArG kuMg== X-Received: by 10.220.238.139 with SMTP id ks11mr80602819vcb.49.1357557871166; Mon, 07 Jan 2013 03:24:31 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp56258veb; Mon, 7 Jan 2013 03:24:29 -0800 (PST) X-Received: by 10.180.107.129 with SMTP id hc1mr8717531wib.34.1357557868838; Mon, 07 Jan 2013 03:24:28 -0800 (PST) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by mx.google.com with ESMTPS id a8si10017823wix.42.2013.01.07.03.24.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Jan 2013 03:24:28 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.46 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=74.125.82.46; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.46 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) smtp.mail=fabio.baltieri@linaro.org Received: by mail-wg0-f46.google.com with SMTP id dr13so9323677wgb.13 for ; Mon, 07 Jan 2013 03:24:28 -0800 (PST) X-Received: by 10.180.87.73 with SMTP id v9mr8534735wiz.26.1357557868419; Mon, 07 Jan 2013 03:24:28 -0800 (PST) Received: from localhost ([2a01:2029:1:11e3:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id dm3sm11643329wib.9.2013.01.07.03.24.22 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Jan 2013 03:24:27 -0800 (PST) From: Fabio Baltieri To: Vinod Koul Cc: Dan Williams , Linus Walleij , Srinidhi Kasagar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Gerald Baeza , Fabio Baltieri Subject: [PATCH 08/16] dmaengine: ste_dma40: physical channels number correction Date: Mon, 7 Jan 2013 12:21:50 +0100 Message-Id: <1357557718-15676-9-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org> References: <1357557718-15676-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQnOndn+TmLC8rUhXySe0Ef85pWNaa1Kg84XrHLt09VY6JSQr63tsvcjJUgrRCcbEcUUfqnd From: Gerald Baeza DMAC_ICFG[0:2]=SCHNB only allows to count 'multiple of 4' physical channels so it was ok with platforms having 8 channels but cannot be used for next versions (with 10 or 14 channels). This patch allows to provide the number of physical channels for a DMA device via platform_data, or still rely on SCHNB if platform_data announces 0 channel. Signed-off-by: Gerald Baeza Reviewed-by: Per Forlin Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- drivers/dma/ste_dma40.c | 15 ++++++++++----- include/linux/platform_data/dma-ste-dma40.h | 4 ++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 5feab7db9..ca18117 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3004,14 +3004,21 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) * ? has revision 1 * DB8500v1 has revision 2 * DB8500v2 has revision 3 + * AP9540v1 has revision 4 + * DB8540v1 has revision 4 */ rev = AMBA_REV_BITS(pid); + plat_data = pdev->dev.platform_data; + /* The number of physical channels on this HW */ - num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; + if (plat_data->num_of_phy_chans) + num_phy_chans = plat_data->num_of_phy_chans; + else + num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; - dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n", - rev, res->start); + dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", + rev, res->start, num_phy_chans); if (rev < 2) { d40_err(&pdev->dev, "hardware revision: %d is not supported", @@ -3019,8 +3026,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) goto failure; } - plat_data = pdev->dev.platform_data; - /* Count the number of logical channels in use */ for (i = 0; i < plat_data->dev_len; i++) if (plat_data->dev_rx[i] != 0) diff --git a/include/linux/platform_data/dma-ste-dma40.h b/include/linux/platform_data/dma-ste-dma40.h index 9ff93b0..833cb95 100644 --- a/include/linux/platform_data/dma-ste-dma40.h +++ b/include/linux/platform_data/dma-ste-dma40.h @@ -147,6 +147,9 @@ struct stedma40_chan_cfg { * @memcpy_conf_log: default configuration of logical channel memcpy * @disabled_channels: A vector, ending with -1, that marks physical channels * that are for different reasons not available for the driver. + * @num_of_phy_chans: The number of physical channels implemented in HW. + * 0 means reading the number of channels from DMA HW but this is only valid + * for 'multiple of 4' channels, like 8. */ struct stedma40_platform_data { u32 dev_len; @@ -158,6 +161,7 @@ struct stedma40_platform_data { struct stedma40_chan_cfg *memcpy_conf_log; int disabled_channels[STEDMA40_MAX_PHYS]; bool use_esram_lcla; + int num_of_phy_chans; }; #ifdef CONFIG_STE_DMA40