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: 9505359 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 4C8D1606E1 for ; Mon, 9 Jan 2017 16:08:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F09E28474 for ; Mon, 9 Jan 2017 16:08:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3401428497; Mon, 9 Jan 2017 16:08:37 +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=unavailable 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 E241928474 for ; Mon, 9 Jan 2017 16:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762297AbdAIQIQ (ORCPT ); Mon, 9 Jan 2017 11:08:16 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37214 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970228AbdAIQHX (ORCPT ); Mon, 9 Jan 2017 11:07:23 -0500 Received: by mail-wm0-f52.google.com with SMTP id c206so37928292wme.0 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=TdhF1ZDFrXPjCcEubklqHnkf8m8nlc9ekgeyXY1nb/Chu/SZmRyaSbSEnykNfwtt2r svdKS7y8Vzboju2MVj/rKZKYfs6geMCg/Wyn9z1phsWyvY7pmI8v7gP5dLGYeW+aTqtY SwTg5DvKfPxuCvPUA0GgrNnWFWSebHKzwJXxAtfy3Ft8haoL+HtFk98cP65p6FMZABQD tlVn3NOmcJI2vg44cs8Ni3dSZfaBQcWZGtHqBx/wNmj57YFl4J4HeHCsbxsBaHFdiFOo 7AQLplA5TPeQ7eFHkJbGmsoYQymF/wRXgmBlLG8f5/fyv2u0QQd5NuX65BELu0QUkFxK 4MEg== X-Gm-Message-State: AIkVDXI10+G5+Or1OZqw7vAhuVyzG4mhCVLUTf+usUGtOxJjOuzrM5xSPXxba+7fjvLNe3gf 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: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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);