From patchwork Tue Apr 23 15:03:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16359 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 619F923A3C for ; Tue, 23 Apr 2013 15:04:43 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r11sf1117613yen.7 for ; Tue, 23 Apr 2013 08:03:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=7WiIWF/f/V3/0zlBTzzBu6M3QuSrCpHyIknAvTJ1uoE=; b=bVFdfWTSMTbVSw/5DfcN7R+3UXsDsaXdWap4QJzSuKND+DzXfZaub/AZHTDOk7zWzX fC54S94C/vZmDtFksQdytjClVCsi42Fgtd5KM7srZ5TB0J5dVvGACh0pq2iowjfg4Ore +q1xUlGdZUbsfBpGQLQVAV1sHVXAJBgPn1c/BPxuW7uZ0CIvMmNr/wgBrC/CiLZ8R7Hp +8zV2ifYhMPq7SDHt5YeKSycWq501+zA2Hf+Jt3q8ATj9qiHbZKYk/NSs64Jqiu5SauK BYWCfrgB4OfpVyqJVIQNvje10N61qFQlTmLlbjQFUUaG+k9Fo5I1IvtvPOFPSPrUIIUa XVeQ== X-Received: by 10.236.82.46 with SMTP id n34mr15291901yhe.24.1366729434444; Tue, 23 Apr 2013 08:03:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.134 with SMTP id u6ls375463qen.79.gmail; Tue, 23 Apr 2013 08:03:54 -0700 (PDT) X-Received: by 10.52.163.231 with SMTP id yl7mr19310881vdb.57.1366729434306; Tue, 23 Apr 2013 08:03:54 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id ha8si10375386vdb.35.2013.04.23.08.03.54 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Apr 2013 08:03:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id gd11so711596vcb.14 for ; Tue, 23 Apr 2013 08:03:54 -0700 (PDT) X-Received: by 10.58.181.201 with SMTP id dy9mr22811564vec.34.1366729434166; Tue, 23 Apr 2013 08:03:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp129529veb; Tue, 23 Apr 2013 08:03:53 -0700 (PDT) X-Received: by 10.180.72.228 with SMTP id g4mr75385252wiv.22.1366729426492; Tue, 23 Apr 2013 08:03:46 -0700 (PDT) Received: from mail-wi0-x22f.google.com (mail-wi0-x22f.google.com [2a00:1450:400c:c05::22f]) by mx.google.com with ESMTPS id e2si6366196wic.58.2013.04.23.08.03.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Apr 2013 08:03:46 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22f is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c05::22f; Received: by mail-wi0-f175.google.com with SMTP id h11so6211211wiv.14 for ; Tue, 23 Apr 2013 08:03:46 -0700 (PDT) X-Received: by 10.194.10.129 with SMTP id i1mr46744337wjb.21.1366729425946; Tue, 23 Apr 2013 08:03:45 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id q20sm16491081wiv.7.2013.04.23.08.03.44 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Apr 2013 08:03:45 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, mian.yousaf.kaukab@stericsson.com, Lee Jones , Felipe Balbi , linux-usb@vger.kernel.org Subject: [PATCH 05/10] usb: musb: ux500: attempt to find channels by name before using pdata Date: Tue, 23 Apr 2013 16:03:09 +0100 Message-Id: <1366729394-11406-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1366729394-11406-1-git-send-email-lee.jones@linaro.org> References: <1366729394-11406-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmULVkrwgdW/6lfXLkSFbLra/ZCX0kS4NO2P+fJ1FKsAMFd0HHPUGSUo17ydY4h9iSlP3oq X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If we can ever get to a state where we can solely search for DMA channels by name, this will almost completely alleviate the requirement to pass copious amounts of information though platform data. Here we take the first step towards this. The next step will be to enable Device Tree complete with name<->event_line mapping. Cc: Felipe Balbi Cc: linux-usb@vger.kernel.org Signed-off-by: Lee Jones --- drivers/usb/musb/ux500_dma.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index 02b4a6e..6eef449 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c @@ -33,6 +33,11 @@ #include #include "musb_core.h" +static const char *iep_chan_names[] = { "iep_1_9", "iep_2_10", "iep_3_11", "iep_4_12", + "iep_5_13", "iep_6_14", "iep_7_15", "iep_8" }; +static const char *oep_chan_names[] = { "oep_1_9", "oep_2_10", "oep_3_11", "oep_4_12", + "oep_5_13", "oep_6_14", "oep_7_15", "oep_8" }; + struct ux500_dma_channel { struct dma_channel channel; struct ux500_dma_controller *controller; @@ -289,6 +294,7 @@ static int ux500_dma_controller_start(struct dma_controller *c) struct musb_hdrc_platform_data *plat = dev->platform_data; struct ux500_musb_board_data *data; struct dma_channel *dma_channel = NULL; + char **chan_names; u32 ch_num; u8 dir; u8 is_tx = 0; @@ -310,6 +316,7 @@ static int ux500_dma_controller_start(struct dma_controller *c) /* Prepare the loop for RX channels */ channel_array = controller->rx_channel; param_array = (data) ? data->dma_rx_param_array : NULL; + chan_names = (char **)iep_chan_names; for (dir = 0; dir < 2; dir++) { for (ch_num = 0; @@ -325,9 +332,15 @@ static int ux500_dma_controller_start(struct dma_controller *c) dma_channel->status = MUSB_DMA_STATUS_FREE; dma_channel->max_len = SZ_16M; - ux500_channel->dma_chan = dma_request_channel(mask, - data->dma_filter, - param_array[ch_num]); + ux500_channel->dma_chan = + dma_request_slave_channel(dev, chan_names[ch_num]); + + if (!ux500_channel->dma_chan) + ux500_channel->dma_chan = + dma_request_channel(mask, + data->dma_filter, + param_array[ch_num]); + if (!ux500_channel->dma_chan) { ERR("Dma pipe allocation error dir=%d ch=%d\n", dir, ch_num); @@ -343,6 +356,7 @@ static int ux500_dma_controller_start(struct dma_controller *c) /* Prepare the loop for TX channels */ channel_array = controller->tx_channel; param_array = (data) ? data->dma_tx_param_array : NULL; + chan_names = (char **)oep_chan_names; is_tx = 1; }