From patchwork Mon Jan 9 16:06:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 90514 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp152151qgi; Mon, 9 Jan 2017 08:08:26 -0800 (PST) X-Received: by 10.84.210.228 with SMTP id a91mr197552723pli.0.1483978106070; Mon, 09 Jan 2017 08:08:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b72si89270012pli.151.2017.01.09.08.08.25; Mon, 09 Jan 2017 08:08:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970226AbdAIQIW (ORCPT + 7 others); Mon, 9 Jan 2017 11:08:22 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36258 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970215AbdAIQHW (ORCPT ); Mon, 9 Jan 2017 11:07:22 -0500 Received: by mail-wm0-f45.google.com with SMTP id c85so102513801wmi.1 for ; Mon, 09 Jan 2017 08:07:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CAKNDvufL9vuFpm//Yo/H9aO//7F6LxykRJNpEwjXA4=; b=TgKlX673q/TO43wS53HyV5wSLQq9NDV4BFE04SCx/npv4WhoGnzSUiQUGSUWr8qdS9 uMFI4fcfCBh0629Y/Tx5dZSVAM+fxgxeMLV9WVkUOsKe9LlzB0giwxXrTSQB9zsLANJP V9sZccxYATfB9j+fg0lkErKCz12pkkaqQLuW/HSlEkDyTELWLSnssZ7AJuThHTAlQWiN 97tCTLyyLJafjizVj0J/MaiC7ztkhM1lJxqFtJ1+qRypoSaD0YVC8RUaUvsY2X/s14IF pRBqHT+u+gIfhIt9xXITNWAKYoi1MBbIPtqW8xMGlCRRR9eihqhfrG5Q0am4tTFFC6Qc 6+nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CAKNDvufL9vuFpm//Yo/H9aO//7F6LxykRJNpEwjXA4=; b=B3/jmSXAA0AmF0RBj2x2y9tUW25IeD/FFyv0ofmve2hPrudugKBlgmS8NbBzk2MhsI UkZmxWxYxq5aTil2pfLg0wUWyGAIYFhtp4n22p/0YIv/Q6jlQxiZXy/d5nTNmHozbuKM IUwo17XpHO5Sr4eXvvSKj2VxWfEh2pnUwXf/OnvVyuUCeFz8J8fumjMLvUyYt05xCKyr 0yvzPIB2s+FPFgnNjZadaE8r9Fo1okZIzyZy3ppmPfJikaneLqrajcEtYeX23bEwL0xB +56NXBTlv2K0xIxxDBcVvUKKX9pT6lW2c/ZBx0kVbxS51FJVJnFMBmFgdzXx6mkRyPNM 2dDg== X-Gm-Message-State: AIkVDXI45VZmDZ0bqQ1pr0rFLJxaVKDtZ9meoyRbPxkngILSbHq3SVy4C8LBsWP+MAOp4TCU X-Received: by 10.28.145.210 with SMTP id t201mr4641839wmd.42.1483978040444; Mon, 09 Jan 2017 08:07:20 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w18sm19656244wme.9.2017.01.09.08.07.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jan 2017 08:07:20 -0800 (PST) From: Alexandre Bailon To: vinod.koul@intel.com Cc: dmaengine@vger.kernel.org, linux-usb@vger.kernel.org, nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, tony@atomide.com, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, b-liu@ti.com, Alexandre Bailon Subject: [PATCH 03/11] dmaengine: cppi41: Move some constants to glue layer Date: Mon, 9 Jan 2017 17:06:48 +0100 Message-Id: <20170109160656.3470-4-abailon@baylibre.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170109160656.3470-1-abailon@baylibre.com> References: <20170109160656.3470-1-abailon@baylibre.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some constants are defined and use by the driver whereas they are specifics to am335x. Add new variables to the glue layer, initialize them with the constants, and use them in the driver. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index 42744ed..d0d3bdd 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -68,7 +68,6 @@ #define QMGR_MEMCTRL_IDX_SH 16 #define QMGR_MEMCTRL_DESC_SH 8 -#define QMGR_NUM_PEND 5 #define QMGR_PEND(x) (0x90 + (x) * 4) #define QMGR_PENDING_SLOT_Q(x) (x / 32) @@ -147,6 +146,8 @@ struct cppi41_dd { const struct chan_queues *queues_rx; const struct chan_queues *queues_tx; struct chan_queues td_queue; + u16 first_completion_queue; + u16 qmgr_num_pend; struct list_head pending; /* Pending queued transfers */ spinlock_t lock; /* Lock for pending list */ @@ -155,7 +156,6 @@ struct cppi41_dd { unsigned int dma_tdfdq; }; -#define FIST_COMPLETION_QUEUE 93 static struct chan_queues am335x_usb_queues_tx[] = { /* USB0 ENDP 1 */ [ 0] = { .submit = 32, .complete = 93}, @@ -233,6 +233,8 @@ struct cppi_glue_infos { const struct chan_queues *queues_rx; const struct chan_queues *queues_tx; struct chan_queues td_queue; + u16 first_completion_queue; + u16 qmgr_num_pend; }; static struct cppi41_channel *to_cpp41_chan(struct dma_chan *c) @@ -286,19 +288,21 @@ static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num) static irqreturn_t cppi41_irq(struct cppi41_dd *cdd) { + u16 first_completion_queue = cdd->first_completion_queue; + u16 qmgr_num_pend = cdd->qmgr_num_pend; struct cppi41_channel *c; int i; - for (i = QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE); i < QMGR_NUM_PEND; + for (i = QMGR_PENDING_SLOT_Q(first_completion_queue); i < qmgr_num_pend; i++) { u32 val; u32 q_num; val = cppi_readl(cdd->qmgr_mem + QMGR_PEND(i)); - if (i == QMGR_PENDING_SLOT_Q(FIST_COMPLETION_QUEUE) && val) { + if (i == QMGR_PENDING_SLOT_Q(first_completion_queue) && val) { u32 mask; /* set corresponding bit for completetion Q 93 */ - mask = 1 << QMGR_PENDING_BIT_Q(FIST_COMPLETION_QUEUE); + mask = 1 << QMGR_PENDING_BIT_Q(first_completion_queue); /* not set all bits for queues less than Q 93 */ mask--; /* now invert and keep only Q 93+ set */ @@ -876,7 +880,7 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) return -ENOMEM; cppi_writel(cdd->scratch_phys, cdd->qmgr_mem + QMGR_LRAM0_BASE); - cppi_writel(QMGR_SCRATCH_SIZE, cdd->qmgr_mem + QMGR_LRAM_SIZE); + cppi_writel(TOTAL_DESCS_NUM, cdd->qmgr_mem + QMGR_LRAM_SIZE); cppi_writel(0, cdd->qmgr_mem + QMGR_LRAM1_BASE); ret = init_descs(dev, cdd); @@ -959,6 +963,8 @@ static const struct cppi_glue_infos am335x_usb_infos = { .queues_rx = am335x_usb_queues_rx, .queues_tx = am335x_usb_queues_tx, .td_queue = { .submit = 31, .complete = 0 }, + .first_completion_queue = 93, + .qmgr_num_pend = 5, }; static const struct of_device_id cppi41_dma_ids[] = { @@ -1036,6 +1042,8 @@ static int cppi41_dma_probe(struct platform_device *pdev) cdd->queues_rx = glue_info->queues_rx; cdd->queues_tx = glue_info->queues_tx; cdd->td_queue = glue_info->td_queue; + cdd->qmgr_num_pend = glue_info->qmgr_num_pend; + cdd->first_completion_queue = glue_info->first_completion_queue; ret = init_cppi41(dev, cdd); if (ret)