From patchwork Fri Mar 25 23:50:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8673541 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C56289F326 for ; Fri, 25 Mar 2016 23:51:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE50F20279 for ; Fri, 25 Mar 2016 23:51:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96B4B20251 for ; Fri, 25 Mar 2016 23:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751868AbcCYXvF (ORCPT ); Fri, 25 Mar 2016 19:51:05 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:33271 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751763AbcCYXvE (ORCPT ); Fri, 25 Mar 2016 19:51:04 -0400 Received: by mail-lf0-f42.google.com with SMTP id f67so8159458lfb.0 for ; Fri, 25 Mar 2016 16:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=S+df/W0JPWkHK0yVWb6uDhY/UvE9IU5/qPVFLBPqpZw=; b=YwmdVr4tB61yJehlU4qSVeqxhmAEZ4R5o38KvBxJHQQjb8IdiwtErr8u0lPnWL6eoU P8X+1Gqmi0h8S+Div68yAq5tgXUROoLWraCBHt+vSaLK+ty7oWVN7imVuBfcwLZWuyn2 porgPX13LHg5NkslILHjCm5IEH4Rh0SEcbHj8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=S+df/W0JPWkHK0yVWb6uDhY/UvE9IU5/qPVFLBPqpZw=; b=T92kr7cYCHA6jCSqS7RtBE4553nDEz2higGzLQCqKk2IDnq4bJ620ztpfNGlXAt6XS qkILvhEamBOfjcO2r/Ad44ouaib2+qWeds4C+LKYo6yab+l3Z9/VbEx+x5Z1D7yllLUW QTFQtBSpPiqLFI70OU3IlSG7iEtLav6AFUWBrvbKwl7NMJsJEFeBDQlU0GVIYj+9oDRg D+VX08UlkvMgj9vbMcSFHghuPHQuulKcTLciXl1exUTLDSwLW/vTNloEz28Sznuu2Vgq IpakjQK7r4iwJPLc0lXGZkWQi+b4WfTmOzJDobfhuiKoiQcnoQItoR6ihxb5Y9zd3nMV +zFg== X-Gm-Message-State: AD7BkJKgu6qT48I8+qScwaKHfngJz79atd7UpZSBd52HHC8YXStRgG9PGSp5ckynfWTl1Hk/ X-Received: by 10.25.30.73 with SMTP id e70mr6481354lfe.13.1458949861980; Fri, 25 Mar 2016 16:51:01 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-927b71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.123.146]) by smtp.gmail.com with ESMTPSA id rk1sm2341953lbb.0.2016.03.25.16.51.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Mar 2016 16:51:00 -0700 (PDT) From: Linus Walleij To: Vinod Koul , dmaengine@vger.kernel.org Cc: Linus Walleij , Maxime Ripard , Joachim Eastwood , Johannes Stezenbach Subject: [PATCH 1/2 v2] dma: pl08x: support fixed signal assignment Date: Sat, 26 Mar 2016 00:50:58 +0100 Message-Id: <1458949858-4679-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some implementations such as the Nomadik do not place a mux in front of the DMA single/burst request signals into the PL08x DMA controller, instead they lock a certain signal to a certain device. This makes things simpler and the platform does not need to implement a muxing function. Implement this scheme and flag that the Nomadik uses this method. While we're at it, add a missing kerneldoc entry. Cc: Maxime Ripard Cc: Joachim Eastwood Cc: Johannes Stezenbach Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Also encode the number of outgoing request signals into the vendor data. This will be used by the next patch to allocate slave channels for the DT probe. --- drivers/dma/amba-pl08x.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 9b42c0588550..2ef80200d110 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -107,19 +107,27 @@ struct pl08x_driver_data; /** * struct vendor_data - vendor-specific config parameters for PL08x derivatives * @channels: the number of channels available in this variant + * @signals: the number of request signals available from the hardware * @dualmaster: whether this version supports dual AHB masters or not. * @nomadik: whether the channels have Nomadik security extension bits * that need to be checked for permission before use and some registers are * missing * @pl080s: whether this version is a PL080S, which has separate register and * LLI word for transfer size. + * @fixed_signals: if the channel signal allocation on the PL08x is fixed, + * i.e. each device burst/single control signals are connected directly + * to the DMAC signal lines without any mux. + * @max_transfer_size: the maximum single element transfer size for this + * PL08x variant. */ struct vendor_data { u8 config_offset; u8 channels; + u8 signals; bool dualmaster; bool nomadik; bool pl080s; + bool fixed_signals; u32 max_transfer_size; }; @@ -319,6 +327,15 @@ static int pl08x_request_mux(struct pl08x_dma_chan *plchan) const struct pl08x_platform_data *pd = plchan->host->pd; int ret; + /* + * For engines with fixed signal assignment for slave transfers, + * this signal is assigned during probe. + */ + if (plchan->host->vd->fixed_signals) { + BUG_ON(plchan->signal < 0); + return 0; + } + if (plchan->mux_use++ == 0 && pd->get_xfer_signal) { ret = pd->get_xfer_signal(plchan->cd); if (ret < 0) { @@ -335,6 +352,9 @@ static void pl08x_release_mux(struct pl08x_dma_chan *plchan) { const struct pl08x_platform_data *pd = plchan->host->pd; + if (plchan->host->vd->fixed_signals) + return; + if (plchan->signal >= 0) { WARN_ON(plchan->mux_use == 0); @@ -1909,6 +1929,18 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x, if (slave) { chan->cd = &pl08x->pd->slave_channels[i]; + /* + * Some implementations have muxed signals, whereas some + * use a mux in front of the signals and need dynamic + * assignment of signals. + */ + if (pl08x->vd->fixed_signals) { + chan->signal = i; + chan->name = chan->cd->bus_id; + dev_dbg(&pl08x->adev->dev, + "assign fixed signal %u to channel %s", + chan->signal, chan->name); + } pl08x_dma_slave_init(chan); } else { chan->cd = &pl08x->pd->memcpy_channel; @@ -2438,6 +2470,7 @@ out_no_pl08x: static struct vendor_data vendor_pl080 = { .config_offset = PL080_CH_CONFIG, .channels = 8, + .signals = 16, .dualmaster = true, .max_transfer_size = PL080_CONTROL_TRANSFER_SIZE_MASK, }; @@ -2445,14 +2478,17 @@ static struct vendor_data vendor_pl080 = { static struct vendor_data vendor_nomadik = { .config_offset = PL080_CH_CONFIG, .channels = 8, + .signals = 32, .dualmaster = true, .nomadik = true, + .fixed_signals = true, .max_transfer_size = PL080_CONTROL_TRANSFER_SIZE_MASK, }; static struct vendor_data vendor_pl080s = { .config_offset = PL080S_CH_CONFIG, .channels = 8, + .signals = 32, .pl080s = true, .max_transfer_size = PL080S_CONTROL_TRANSFER_SIZE_MASK, }; @@ -2460,6 +2496,7 @@ static struct vendor_data vendor_pl080s = { static struct vendor_data vendor_pl081 = { .config_offset = PL080_CH_CONFIG, .channels = 2, + .signals = 16, .dualmaster = false, .max_transfer_size = PL080_CONTROL_TRANSFER_SIZE_MASK, };