From patchwork Mon Jan 9 16:06:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9505339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE1F560762 for ; Mon, 9 Jan 2017 16:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E073828474 for ; Mon, 9 Jan 2017 16:08:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D521C28493; Mon, 9 Jan 2017 16:08:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7836E28497 for ; Mon, 9 Jan 2017 16:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970205AbdAIQIS (ORCPT ); Mon, 9 Jan 2017 11:08:18 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38650 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970226AbdAIQHX (ORCPT ); Mon, 9 Jan 2017 11:07:23 -0500 Received: by mail-wm0-f51.google.com with SMTP id k184so126047600wme.1 for ; Mon, 09 Jan 2017 08:07:23 -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=tk9aRpNUC867Cr7u/I0BnTK4ASHH4WMGnWCYQCWQaDQ=; b=IHht3YvCJqY0zM+DHctawX0KDwfr/3LXIeKq02eeyQS5s/00UJx21E2aKeDNg45k2F tHFjd3M6dMgJ5PUa1mj2qPAciTfj2RwXlaGCYd70SJwh+PKZi7RYvo3UTFP1DAbQyghn XkGtzA04BHMhy0U+wLrH5TGuSITCAhvJAnpF+GQnK5NwamoKc4wXGbqVF1RFGDTT83lS 9OQcUX1g+BO3cqcjCkuz6vTFaNlVRB3KU0xtbH6nKyDIQcvUjh0en9huswG6ojrtUXLh 4Q3kRBf8llPTMf9M3SfcnkWfxgQe3GEl1pgTyyebcKaKJVt4/NV8A/s4R9LKbbRMsWug YuHw== 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=tk9aRpNUC867Cr7u/I0BnTK4ASHH4WMGnWCYQCWQaDQ=; b=jRNylo4DZPbQyygPWgZX7HUDkcf7kyzqPOD0B1R04cfli7SgPn6d371Dlh9GMyztnV 576qgIru3lMAzWM2bNo5zNi/rBfvZTnEmpk3XLaf86wusumEGJDdS8PKCBNRq8pekYhi MfaurFja5jZqR21dSa5WvRbU6DD3AxjqRDdOs0VmM18wLmPN+aZ4/akORkthr7WBULJA YuHwhzOXvUWcsSZWgFX0b3aXdWEwt4flCU5LohlsrcdKR4piZH633iex7h6bOpdfqgn9 J+qkYxpVpf3uofJDd22Hnq6wnCFHQlOdDjd8+ZDtdDZ9aZrjDBh4/OI3Dw4w6Qaq5a7e s21w== X-Gm-Message-State: AIkVDXKY60CpeGRSojhIxiPXgFTAyyGZwhcqZqbyBS6O5PZ910C3d2xfZ1PDVq+4Yor01E8j X-Received: by 10.223.178.9 with SMTP id u9mr236550wra.125.1483978042349; Mon, 09 Jan 2017 08:07:22 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w18sm19656244wme.9.2017.01.09.08.07.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jan 2017 08:07:21 -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 05/11] dmaengine: cppi41: Add a way to test if the driver is running on am335x Date: Mon, 9 Jan 2017 17:06:50 +0100 Message-Id: <20170109160656.3470-6-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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As the cppi41 is present in different platform, the driver needs to determine on which platform it is running to execute instructions specific to this platform (such as configure IRQ on am335x). Add a way to test if we are running on am335x. Signed-off-by: Alexandre Bailon --- drivers/dma/cppi41.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index 8d7965d..58b27ef 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -89,6 +89,8 @@ /* Packet Descriptor */ #define PD2_ZERO_LENGTH (1 << 19) +#define AM335X_CPPI41 0 + struct cppi41_channel { struct dma_chan chan; struct dma_async_tx_descriptor txd; @@ -237,6 +239,7 @@ struct cppi_glue_infos { struct chan_queues td_queue; u16 first_completion_queue; u16 qmgr_num_pend; + u8 platform; }; static struct cppi41_channel *to_cpp41_chan(struct dma_chan *c) @@ -966,6 +969,7 @@ static const struct cppi_glue_infos am335x_usb_infos = { .td_queue = { .submit = 31, .complete = 0 }, .first_completion_queue = 93, .qmgr_num_pend = 5, + .platform = AM335X_CPPI41, }; static const struct of_device_id cppi41_dma_ids[] = { @@ -984,6 +988,13 @@ static const struct cppi_glue_infos *get_glue_info(struct device *dev) return of_id->data; } +static int is_am335x_cppi41(struct device *dev) +{ + struct cppi41_dd *cdd = dev_get_drvdata(dev); + + return cdd->platform == AM335X_CPPI41; +} + #define CPPI41_DMA_BUSWIDTHS (BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \ BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \ BIT(DMA_SLAVE_BUSWIDTH_3_BYTES) | \ @@ -1045,6 +1056,7 @@ static int cppi41_dma_probe(struct platform_device *pdev) 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; + cdd->platform = glue_info->platform; ret = of_property_read_u32(dev->of_node, "#dma-channels", &cdd->n_chans);