From patchwork Thu May 10 07:00:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 135394 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp650478lji; Thu, 10 May 2018 00:01:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqZiijiBjuSDHzOhYz/9jguuLOq7eZWBcMyJAWBKyNyhJHPMs/2reEzZIaEEXGFxH022nZt X-Received: by 2002:a17:902:780d:: with SMTP id p13-v6mr213377pll.281.1525935666018; Thu, 10 May 2018 00:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525935666; cv=none; d=google.com; s=arc-20160816; b=WYHXbivdQc0EnnrYaq2B/AsNKEgJHf5WwJSEKRmr26LqkKf4QbxkJRnhRE21OkojRh /5BUK8Jz81n0UO1lP+wxbEr2lvMxWJSyIQPdPhIYvPe4H1wP5hTHq/V5KYJHBaGi9Jfe hqG518hSEMRyXCt75+H/GbqeQyRJyN6GyWRVhbNh+IjIfH2vQTrnd0ZQZjqdXrh8/Vbc 5nAzyDJiR0CyPiTbi6BsRm0KbucAEGDE4u0BGmhKJysa95NZDo5kTYka14ZAnGlPm7Fh 0rNoZ+E6zgJ/wSCgADJm5D5K+N/kCd6c7ugZ3FLx4wKEvgC2YuX7JCxjTLzflujNeB+V 9+Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=nfFfzHd03/WvP4nNMzjF1Epy+vua/80m82WNcavHOuI=; b=YgVpprrqBPjv2mW+kdAX7oyxA6DZMDEb7GWOsa3lY+mwnCCmPU2Bdi3/2pbRzYkaT9 j/oVqXDCgVfR2tATplmnejEpUtoa5dez8sDjz5uvYvvvmN6X+OqVOk7sSe3gXJ+gLMA/ MPY9Wk1G1kkZrvaTADlX3rvq2zOgE1OAqni/85hEGxBPE/6/SxBC1HlSt9iz5IjmcQDE ZrXgzcbP4xqHQexgWZTSk4qdqRoZ/rpQDm+FwXZUM39KKO8Wb3v/IU0RwJ5TPu0DpdQ9 zmEq/G+8Vg9NQuDVBfZnGPa1k7PvytBl0O/vZ+B851mGVi/N26UZvmMp4QhQJ/ejLX/r cRlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=YfeqZL6y; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si126149pgc.166.2018.05.10.00.01.05; Thu, 10 May 2018 00:01:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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=@samsung.com header.s=mail20170921 header.b=YfeqZL6y; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756706AbeEJHBF (ORCPT + 3 others); Thu, 10 May 2018 03:01:05 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:58022 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756305AbeEJHBE (ORCPT ); Thu, 10 May 2018 03:01:04 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180510070102euoutp02512700f1147f459554fb9566d272e154~tNmZsIZAZ0134801348euoutp02K; Thu, 10 May 2018 07:01:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180510070102euoutp02512700f1147f459554fb9566d272e154~tNmZsIZAZ0134801348euoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1525935662; bh=FUdXmm8g1EQjzdo5DbEbwiYcvEpGaBDcya6NG8/XW3w=; h=From:To:Cc:Subject:Date:References:From; b=YfeqZL6ycZDX1wFrCm6bpPkzVdVK8uFJMtFkVofDODqNhaLBP1Hqvr88rJEQKPBLQ m+JCh4MaN8bhmXSLbo/tbn71OSeU2bCmCOtrfLJJHICtJzadOZjQAghNThjs28JrmP KN7BpFDHdfmj8CyEKAa7XCPeIZ0Jo57sXoH1PpEI= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180510070101eucas1p166e00a73d4b54bed361ee42b5e9df84c~tNmYkI6BO0314103141eucas1p1l; Thu, 10 May 2018 07:01:01 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id BF.E5.05700.C2EE3FA5; Thu, 10 May 2018 08:01:00 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180510070100eucas1p18471f87d5ad964ab185c6d9a11879ded~tNmXl948h0531705317eucas1p1K; Thu, 10 May 2018 07:01:00 +0000 (GMT) X-AuditID: cbfec7f2-1dbff70000011644-fc-5af3ee2c23dc Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 78.DD.04183.B2EE3FA5; Thu, 10 May 2018 08:01:00 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P8I00A0P3HKVC20@eusync1.samsung.com>; Thu, 10 May 2018 08:00:59 +0100 (BST) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman Subject: [PATCH] serial: samsung: check DMA channel capabilities before using DMA mode Date: Thu, 10 May 2018 09:00:48 +0200 Message-id: <20180510070048.9035-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsWy7djP87o67z5HGfw4rWaxccZ6VovmxevZ LM6f38BuMeP8PiaLM4t72S3WHrnLbnH4TTurA7vHplWdbB77565h9+jbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MLW9WMRfM4q34M/8WewPjf64uRk4OCQETiQdn5jJ3MXJxCAmsYJSY3Xmb HcL5zCjxcddZti5GDrCqS9vNQRqEBJYxSmxr0oCoaWCSeNL1kxkkwSZgKNH1tosNxBYRcJaY fXYhE0gRs8AHRomF61+DFQkLREgsmXcBzGYRUJVonbmDEcTmFbCRaO7dxQ5xkrzEs+nzwK6Q EHjKKrHo2AU2iISLxNsbb1khbGGJV8e3QDXISFye3M0CYddL9H0/wgTR3MMosbdlKhNEwlri 8PGLYM3MAnwSk7ZNZ4Z4jVeio00IosRDYuLD2ywQYUeJ63+DIT6Olbj7Zi/LBEbJBYwMqxjF U0uLc9NTiw3zUsv1ihNzi0vz0vWS83M3MQJj7vS/4592MH69lHSIUYCDUYmHdwbX5ygh1sSy 4srcQ4wSHMxKIrw/zgGFeFMSK6tSi/Lji0pzUosPMUpzsCiJ88Zp1EUJCaQnlqRmp6YWpBbB ZJk4OKUaGGvfz7gTHCEz+9CR73+WHFthvfdHv19E+qkP08KXXy7/Uen3n89xqvvlj59fd8wV ssz/2ljxf/PmHIUr94PKHwttXbfslEdR9vuFHPyLblxlUvhgeiC6Laye21pdccXikNcb/d/8 +OJnH/prpUj2tCa/9Zf/sX0ONM+9oL3J9cnTfzM33qs+t+KWEktxRqKhFnNRcSIAGyjxnrUC AAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsVy+t/xy7o67z5HGSxUtdg4Yz2rRfPi9WwW 589vYLeYcX4fk8WZxb3sFmuP3GW3OPymndWB3WPTqk42j/1z17B79G1ZxejxeZNcAEsUl01K ak5mWWqRvl0CV8aWN6uYC2bxVvyZf4u9gfE/VxcjB4eEgInEpe3mXYycHEICSxgl5t006WLk ArKbmCQubznHApJgEzCU6HrbxQZiiwg4S8w+u5AJpIhZ4BOjRMuia4wgCWGBCIlv5xqZQWwW AVWJ1pk7wOK8AjYSzb272EFsCQF5iWfT57FPYORawMiwilEktbQ4Nz232EivODG3uDQvXS85 P3cTI9D/24793ALU/y74EKMAB6MSD+8Hns9RQqyJZcWVuYcYJTiYlUR4f5wDCvGmJFZWpRbl xxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamA0bPz/I/1tH/sStuQ/tRIa UU8l9hxr6PCeYHEtdOVyk4X9Oz/YzGf4JOHKIyK5Q9CE58cDpmrPNwzMswXC9v6dve1CseO6 9WZ34uxTvmXUpItVZb+c3vnN3oBH8eeKz7I/6vWKrszjPczCdWLDT/UV0a5KJdXHN52Imm8h /pvdTSAlemJj0j0lluKMREMt5qLiRAAY0pCu+wEAAA== X-CMS-MailID: 20180510070100eucas1p18471f87d5ad964ab185c6d9a11879ded X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180510070100eucas1p18471f87d5ad964ab185c6d9a11879ded X-RootMTR: 20180510070100eucas1p18471f87d5ad964ab185c6d9a11879ded References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org DMA engine driver might not always provide all the features needed by serial driver to properly operate in DMA mode, so check that before selecting DMA mode. Signed-off-by: Marek Szyprowski --- drivers/tty/serial/samsung.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 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/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 64e96926f1ad..334b53c6eb14 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -856,6 +856,7 @@ static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state) static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) { struct s3c24xx_uart_dma *dma = p->dma; + struct dma_slave_caps dma_caps; int ret; /* Default slave configuration parameters */ @@ -874,6 +875,13 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) if (IS_ERR(dma->rx_chan)) return PTR_ERR(dma->rx_chan); + ret = dma_get_slave_caps(dma->rx_chan, &dma_caps); + if (ret < 0 || + dma_caps.residue_granularity < DMA_RESIDUE_GRANULARITY_BURST) { + ret = -ENODEV; + goto err_release_rx; + } + dmaengine_slave_config(dma->rx_chan, &dma->rx_conf); dma->tx_chan = dma_request_chan(p->port.dev, "tx"); @@ -882,6 +890,13 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) goto err_release_rx; } + ret = dma_get_slave_caps(dma->tx_chan, &dma_caps); + if (ret < 0 || + dma_caps.residue_granularity < DMA_RESIDUE_GRANULARITY_BURST) { + ret = -ENODEV; + goto err_release_tx; + } + dmaengine_slave_config(dma->tx_chan, &dma->tx_conf); /* RX buffer */